Forum Moderators: open

Message Too Old, No Replies

Assigning multiple values to a combobox

Having problems with combobox recognizing XML values

         

catcherintherye51

7:12 pm on Aug 9, 2006 (gmt 0)

10+ Year Member



How would I correct this code so that it will read multiple values from my XML file? I tried the follwing code, but the comboBox just populated itself with "[object Object]. ." eight times, once for each XML line item:


var myData:XML = new XML ();
myData.ignoreWhite = true;
myData.load ("myxml.xml");
myData.onLoad = function (success:Boolean):Void
{
if (success)
{
var data:XMLNode = this.firstChild;
var children:Array = data.childNodes;
var numItems:Number = children.length;
for (var i:Number = 0; i < numItems; i++)
{
var child:XMLNode = children[i];
obj = {villaname:villaname[i],cx:cx[i],cy:cy[i]};
comboBox.addItem(obj.villaname, obj);
}
}
}

And here's the XML file:


<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<img villaname="Select Villa" />
<img cx="0" cy="0" villaname="POINT ZERO" />
<img cx="308" cy="580" villaname="Villa Clara Vista" />
<img cx="420" cy="458" villaname="Villa Maria" />
<img cx="367" cy="595" villaname="Villa Saint-Amour" />
<img cx="360" cy="650" villaname="Villa la Cima" />
<img cx="380" cy="605" villaname="Villa la Perla" />
<img cx="580" cy="750" villaname="Villa Luca" />
</gallery>

Any ideas? Probably an easy fix - but a little beyond me!