|
-
XML comboBox to text field?
Hi,
I am going crazy on this problem, hopefully someone can help.
I have a comboBox populated through XML. I want to transfer the selected item to a dynamic text field. After a few days and lots of hours... I cant figure this out.
I have added my comboBox to the stage via the component wondow. Would that be my issue? Would it be best to set it through AS3?
Here is my code..
ComboBox prompt:
Code:
item.colour.prompt = xmllist2[p].colours.colour[0];
XML:
Code:
<colours>
<colour>blue</colour>
<colour>burgundy</colour>
<colour>brown</colour>
</colours>
Text field ( I have tried a thousand things like selected items, labels.. but there is something I am doing wrong because it does not work at all)
Code:
item.itemdesc.text = item.colour.selectedLabel;
Any pointers to the right direction?
Thanks!
-
Oh and maybe I should let you know how I get the info into the comboBox:
PHP Code:
var colorList:XMLList = new XMLList(xmllist2[p].colours.colour); for(var o:int = 0; o < colorList.length();o++){ item.colour.addItem({data:colorList[o],label:colorList[o]}); }
-
Ok, here is some progress, but it still does not work.
Hopefully someone can help now?
I have added a function to handle the change of the combo box, but the issue is that it is not passing the updated variable to the text box...?? ANy idea why? please?
Code:
var colourChoice:String = new String();
colourChoice = "";
item.colour.addEventListener(Event.CHANGE, changeHandler);
function changeHandler(event:Event):void {
if(ComboBox(event.target).selectedItem.label != ""){
colourChoice = (ComboBox(event.target).selectedItem.label.toString());
trace (colourChoice);
}
};
item.itemdesc.text = colourChoice;
-
I still havent find the solution for this problem. I am really stuck..
Any one?
please?
-
did you find it??
i have the exact same dilemna now
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|