Hi,
I have a custom class (SlideShow) that I'm including in an MXML document.
In the same MXML document, I add several UIComponents as children of SlideShow.
I would like the SlideShow class to be able to access those UIComponents (e.g.
change the text of
a Text object). Right now, I am stepping through children to get the
references to each UI
object. But a change in the layout will break my application. Is there a way
to get a
child/subchild/subsubchild/etc without trawling through the hierarchy (sort of
like the double
dot operator in XML parsing)?
Here is my example:
<ss:SlideShow id="slideshow" width="800" height="600">
<mx:HBox id="my_hbox">
<mx:Text id="my_txt" text="Description Goes Here" />
</mx:HBox>
</ss:SlideShow>
To get the Text object, I am currently doing:
var my_hbox:HBox = HBox(getChildByName("main_hbox"));
var my_txt:Text = Text(my_hbox.getChildByName("my_txt"));
But it's clear that this is not a good way to do it because if I want to change
the MXML code
(make the HBox a VBox or add more HBoxes, etc) then the "path" to the Text
object will change.
I'm looking for a solution that is more like:
var my_txt:Text = Text(getChild("my_txt"));
which would return a reference to the Text object irrespective of where it
lives in the child
hierarchy.
Thank you very much in advance for your help,
James
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:4499
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37