One way is to use .parent, because the RadioButton is a child of VBox so that 
VBox is its parent.

Another way is to use the fact that if you give the VBox tag an id like 
id="vb", then you can refer to the ith VBox as vb[i]. And you can determine 
what value of i to use by using the .instanceIndex property of the RadioButton 
that you're processing.

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of coder3
Sent: Wednesday, August 05, 2009 5:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] how to find a dynamic object in a function?



Hi All,

This might be a simple question, but I have no clue:

For example, I use mx:Repeater to create a list of radioButton, each inside
a vBox, so the code is like this:

<mx:RadioButtonGroup id="myRG" itemClick="selectMyRadio(event)"/>
<mx:Repeater id="myRP" dataProvider="{myList}">
<mx:VBox name="{myRP.currentItem.value}VB" >
<mx:RadioButton value="{myRP.currentItem.value}"
label="{myRP.currentItem.label}" groupName="myRG" />
</mx:VBox>
</mx:Repeater>

what i want to do is, when user selects one radio button, i want to use its
VBox to do something, how to i get the vBoxobject in the function?

private function selectMyRadio(event:Event):void
{
// so i can get the selected radio button value:
event.currentTarget.selectedValue
// now how to get the vbox object from the application by using that
value? the vBox name is: value+"VB"
}

thanks!

C

--
View this message in context: 
http://www.nabble.com/how-to-find-a-dynamic-object-in-a-function--tp24838597p24838597.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to