BTW,

I just added that simple little line and it works just like expected.

Well, who says wasting hours on a solution that takes 1 second is a bad thing?! :-)

Peace, Mike

On 3/14/06, Michael Schmalle <[EMAIL PROTECTED]> wrote:
Manish, HAAAA

I feel like an idiot! I forgot the styleName pointer. OMG!

Your right, this is where I messed up. I guess I am doing tomany things at once.

I feel like a newbie right now man.

Thanks a lot.

PS Is it convention now that you put all child creation calls in an if() statement? I thought createChildren() only ran once. Did this change in Flex2?

Peace, Mike

On 3/14/06, Manish Jethani < [EMAIL PROTECTED]> wrote:
On 3/14/06, Michael Schmalle <[EMAIL PROTECTED]> wrote:

>  I understand what you wrote, I guess my question is more about the implementation of getStyle().
>
>  If you have a sub component that needs to access 'sizerThickness', and it's a composited component that stands on it's own as a 'component', should I declare that style on the Host component.

Let's say you have a main component, say "Foo".  And you have a
subcomponent, say "Sizer".  Every Foo has a Sizer.  The Sizer's colour
is determined by Foo's "sizerColor" style.  The Sizer instance lives
in the `allChildrenList` of Foo.

Given the above scenario, "sizerColor" should be declared as a style
of Foo, so you can write MXML code like so:

<Foo sizerColor="silver" />

Now your question is: how does the Sizer know its colour?

In the `createChildren` of Foo, where the Sizer instance is created,
its `styleName` property is set to point to the Foo instance.

override protected function createChildren():void
{
  if (!sizer) {
   sizer = new sizerClass();
   sizer.styleName = this; // XXX
  }

  super.createChildren();
}

Now, inside Sizer's code, when you call `getStyle`, it actually gets
the style value off the style settings of the Foo object.  So
`styleName` is the important thing here.

Got it?

When you create extra chome objects in your component's
`createChildren`, just point their `styleName` to `this`.

Manish


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
What goes up, does come down.



--
What goes up, does come down.

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to