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 Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/