Mr samarudge,
Your code is written in a right way!, and It works. But whats the problem is
before reading your xml, the trace statement is executed once. You should give time to load your xml and after that only have to use trace statement. Thats the problem!.
you can test this by using the below code.
var songdataurl:String;
var xml:XML;
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
urlLoader.load(new URLRequest("data.xml"));
function onXMLLoaded(e:Event):void{
xml = new XML(e.target.data);
GetSongData();
}
function GetSongData():void{
songdataurl = xml..song[0];
}
var timer:Timer=new Timer(500);
timer.addEventListener(TimerEvent.TIMER,process);
timer.start();
function process(e:TimerEvent):void
{
trace(songdataurl);
}
Hope this helps!
Reputation Points: 167
Solved Threads: 239
Nearly a Posting Virtuoso
Offline 1,445 posts
since May 2008