I have an XML that i retrieve from a call so all values are dynamic exept for the labels of the nodes(so I know that there is a appname that I have to display). I display appname in a ComboBox, then I need to get another value from another label in the same node, my xml has structure like so
<root>
<item>
<name>Hello</name>
<version>World</version>
</item>
<item>
<name>See_you</name>
<version>soon</version>
</item>
</root>
Now, I have a flex mx:ComboBox that has dynamic values, the user selects the label , for example Hello, and I need to find the corresponding node value, and the child value, so i can return World.
I can define the labels of the ComboBox via dataProvider, so it's done. Now I cannot get the selected value via trace(event.currentTarget.selectedItem.@label); (I have on change handler on the ComboBox) = that's 1 problem;
Second problem is how can I get a node value from an xml object if I have another node value in the same parent node( in this case)?
I'm stuck on this and running out of time, please help. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ i have it like this in my mxml
<mx:AddChild relativeTo="{VGroup}">
<mx:ComboBox id="AppListBox" change="AppListBox_changeHandler(Event.CHANGE)"/>
</mx:AddChild>
then i provide data, when I have it in my script, like so
AppListBox.dataProvider = appxml.item.appname.text();
appxml - is a that xml
Then I try to get the value of selected item, i tried like that:
protected function AppListBox_changeHandler(event:Event):void
{
trace(event.currentTarget.selectedItem.label);
trace(event.currentTarget.selectedItem.data);
trace(event.currentTarget.selectedItem.@label);
trace(AppListBox.selectedItem.label);
trace(AppListBox.selectedItem.@label);
trace(AppListBox.selectedItem.name);
it does not display anything. not even error