Flex 101: Referencing public properites from child components

This is actually very obvious thing but I missed it when I first tried to use public properties like “width” in a child component. I was confused about the scope of the “width” property. Am I referring to the child component?…

All the properties that are referred to by a child component is scoped to the top component in which it resides. If the top component also resides in the application instance, the properties being referred to stay scoped to the top component. If the top component is an Application, then the scope is the Application instance. In the following example, “width” property used by Label refers to the width of VBox.

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Panel title="try something new">
<Label width="{width-16}'/>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: