Flash AS3 loading XML into listbox
Posted
by Anne
on Stack Overflow
See other posts from Stack Overflow
or by Anne
Published on 2010-03-16T09:06:16Z
Indexed on
2010/05/12
8:04 UTC
Read the original article
Hit count: 272
I am able to load my XML file into flash and trace results. Want to populate listbox with information from xml file.
Structure of xml file:
<eBorders>
<item>
<thumb>borderTh/blank_th.jpg</thumb>
<file>border/blank.jpg</file>
</item>
<item>
<thumb>borderTh/border1_th.jpg</thumb>
<file>border/border1.jpg</file>
</item>
</eBorders>
AS3 code:
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("xml/borders.xml"));
var dp:DataProvider = new DataProvider("borders.xml");
border_lb.dataProvider = dp;
border_lb.iconField = "iconSource";
border_lb.rowHeight = 45;
function processXML(e:Event):void {
myXML = new XML(e.target.data);
for(var i:int=0;i<myXML.*.length(); i++){
dp.addItem({iconSource:myXML.item.thumb.[i]});
}
}
Code is producing error I can't find.
Thank you in advance for any help you might offer.
Annie
© Stack Overflow or respective owner