A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [RESOLVED] must be doing something minor and dumb- XML into List component

  1. #1
    Member
    Join Date
    Jul 2009
    Posts
    88

    resolved [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
    Last edited by krashe1313; 07-17-2009 at 04:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center