Hy@all,
i have a little Problem with the XMLLoader
I have here an AS3-project in which I will like to take Greensock LoaderMax to two XML files and the pictures that are in the XML files to preload.
The XML files LoaderMax reads well, but as I am now on the contents of the XML. How can I now attribute to an instance of the XML
Records access?
my XML files:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
Code:
<?xml version="1.0" encoding="UTF-8" ?>
Here AS3 code
Code:
import com.greensock.loading.*;
import com.greensock.loading.display.*;
import com.greensock.events.LoaderEvent;
/////////////////////////////
// XML Loader //
////////////////////////////
LoaderMax.activate([imageLoader, SWFLoader, DataLoader]);
//create an XMLLoader
var areaLoader:XMLLoader = new XMLLoader("../xml/area.xml", {name:"xmlArea", requireWithRoot:this.root, estimatedBytes:1400});
var contLoader:XMLLoader = new XMLLoader("../xml/content.xml", {name:"xmlContent", requireWithRoot:this.root, estimatedBytes:1400});
//begin loading
areaLoader.load();
contLoader.load();
//LoadHandler for XML Loader
var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
var queue2:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
//append the XMLLoader and several other loaders
queue.append( areaLoader );
queue2.append( contLoader);
//begin loading queue
queue.load();
queue2.load();
This is my code from completeHandler:
function completeHandler(event:LoaderEvent):void {
if(event.target.name == "areaXML"){
var areaXML:XML = new XML(areaLoader.content);
areaXML.ignoreComments = true;
areaXML.ignoreWhitespace = true;
trace(areaXML);
var anzahl = areaXML.item.length();
for(var i:int = 0;i trace(areaXML.item[i].@id);
}
}
}
I tried to put the data from getContent () into an XML object, but since then I could not drive the childs.
Does anyone have a tip for me or any advice?
Greetings Mah1987