I’ve got a MovieClip with a linkage name of trackInfo. I’m trying to get XML information in a for loop to create and populate instances of the MovieClip for the length of the XML file.
Here’s what I have so far:
var myXML:XML;
var myURL:URLRequest = new URLRequest("tracks.xml");
var myURLLoader:URLLoader = new URLLoader(myURL);
myURLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
myXML = new XML(e.target.data);
// Can't use the function until the entire XML file is loaded
// stage.addEventListener(Event.ENTER_FRAME, flipPage);
for (var i:int = 0; i<myXML.track.length(); i++) {
trace(myXML.track*.attribute("artist"), myXML.track*.attribute("album"), myXML.track*.attribute("song"));
var newPage:CreatePage = new CreatePage(myXML.track*.attribute("artist"), myXML.track*.attribute("album"), myXML.track*.attribute("song"));
var trackInfoField:trackInfo = new trackInfo();
trace(trackInfoField);
this.trackInfo1.addChild(newPage);
}
}
I thought I could do something like this:
this.trackInfo*.addChild(newPage);
But it’s flaggin an error. Any suggestions?