Populate an existing array from XML -
i've searched averywhere, can't find answer applies me. have as3 array currentely populated manually inside script , rest of code array. how can 'convert' array populate using xml without affecting rest of code. code:
var my_info_array:array = new array("info-pdf.swf", "info2-pdf.swf"); //this first line want populate using xml without affecting code below var infourlnow:number = 0; var mytimer2:timer = new timer(5000); mytimer2.addeventlistener(timerevent.timer, timerlistener); function timerlistener (e:timerevent):void{ if(infourlnow != totalinfo) { loadinfo(); } else { infourlnow = 0; loadinfo(); } } mytimer2.start(); loadinfo(); function loadinfo(){ var infoloader:loader = new loader(); var infourl:string = my_info_array[infourlnow]; var infourl:urlrequest = new urlrequest(infourl); infoloader.load(infourl); info_kozel.addchild(infoloader); infoloader.x = 20; infoloader.y = 20; infoloader.scalex = infoloader.scaley =1.25; infourlnow = infourlnow +1; }
something this:
var data:xml = new xml(); var xml_loader:urlloader = new urlloader(); xml_loader.load(new urlrequest("info.xml")); xml_loader.addeventlistener(event.complete, do_xml);
then how integrate above code do_xml function??
try :
var xml:xml = <list> <link>info-pdf.swf</link> <link>info2-pdf.swf</link> </list>; var my_info_array:array=[]; xml..link.(my_info_array.push(text())); trace(my_info_array) // info-pdf.swf,info2-pdf.swf
Comments
Post a Comment