Hi
I have loaded xml data into a tile list and added event listener to capture clicks. When I click an item in TileList, i intend to add the item label into a TextArea. All goes well. Yet, the problem is item label gets updated instead of appended to the TextArea. I hope it can be fixed. Any help would be appreciated.
Thank you
Kristtee
---------- Here is the code and xml-----------------
<?xml version="1.0" encoding="UTF-8"?>
<lib>
<itm name="One" sos="images/1.png" />
<itm name="Two" sos="images/2.png" />
<itm name="Three" sos="images/3.png" />
<itm name="Four" sos="images/4.png" />
<itm name="Five" sos="images/5.png" />
</lib>
AS3 Code
-----------
import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
var xmlData:XML;
var path:String = "tlData.xml";
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, dataLoaded);
loader.load(new URLRequest(path));
function dataLoaded(e:Event):void{
System.disposeXML(xmlData);
xmlData = new XML(e.target.data);
for(var i:int = 0; i<xmlData.itm.length(); i++){
//trace(xmlData.itm[i].@name);
myTL.addItem({label:xmlData.itm[i].@name, source:xmlData.itm[i].@sos});
}
myTL.addEventListener(Event.CHANGE, ecHandler);
myTL.selectedIndex = 0;
}
function ecHandler(event:Event):void{
//trace(myTL.selectedItem.label);
myTa.text = myTL.selectedItem.label;
}