I can’t figure out why this isn’t working!
The movieclip variables I create in the xml loop no longer exist after I load a picture into it. Specifically books[].url is undefined when you click the movieclip. What’s going on?
#include “lmc_tween.as”
var books:Array = new Array();
var i:Number = 0;
var xmlPath = “”;
var picPath = “…/Image/books_small/”;
var newBook:Object;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
newBook = thumbs_mc.createEmptyMovieClip(“book_”+i, thumbs_mc.getNextHighestDepth());
newBook._alpha = 0;
newBook.pic = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
newBook.url = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
books.push(newBook);
}
loadBooks(0);
} else {
debug_txt.text = “XML not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(xmlPath+“books.xml”);
loadBooks = function (i) {
plistener = new Object();
image_mcl = new MovieClipLoader();
image_mcl.addListener(plistener);
image_mcl.loadClip(picPath+books*.pic, books*);
plistener.onLoadComplete = function(target_mc) {
trace(target_mc.url);
target_mc.alphaTo(100, 1);
target_mc.onRelease = function() {
getURL(this.url);
};
target_mc.onRollOver = function() {
this.brightnessTo(30, 1);
};
target_mc.onRollOut = function() {
this.brightnessTo(0, 1);
};
target_mc._x = i*110;
i += 1;
i<books.length ? loadBooks(i) : null;
};
};