[RESOLVED] must be doing something minor and dumb- XML into List component
RESOLVED*
I hope this is simple. Seems like i just have something a hair off.
On my stage, i have the List component with the instance name of "theList".
Along with the following code:
Code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
var xml:XML;
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
var il:XMLList = xml.item;
for (var i:uint =0; i <il.length(); i++)
{
theList.addItem({label:il.item.text()[i]});
trace(il.text()[i]);
}
}
loader.load(new URLRequest("http://localhost:8888/MAMP/SHIELDS/products.php"));
Now products.php, links to a mySql database and those two are playing together just fine. When I run
Code:
trace(il.text()[i]);
I get the complete item list that looks exactly like this in the output window:
Code:
Beach Ball
LawnChair
Hammock
Electric Razor
Pool Cue
Coffee Machine
Organizer
Perfect.
I just can't get the item list to appear on my list component "theList" on line:
Code:
theList.addItem({label:il.item.text()[i]});
All i get is a blank rectangle for each item that i can roll over. No text though.
Thoughts?
Big thanks!!!
`Shields
*In my line:
Code:
theList.addItem({label:il.item.text()[i]});
i accidentally put the .item in before the text() and I didn't need to because i declared it earlier at:
Code:
var il:XMLList = xml.item;
i knew it was a dumb mistake. thanks for your time