I cant seem to make my preloader disappear after the MovieClipLoader class has determined the load is complete. I have a movieclip I attach onto the stage called thumbnailModule_mc inside of it I have the preloader movieclip (a simple spinning circle) and the image holder movieclip that the MovieClipLoader is listening to see when the image load is complete. When the load completes I want to set the alpha to zero and fade in the image. But my code doesn’t work! the preloader stays visible. I cant figure out what is wrong.
Here is my code:
function loadHomeBar(xmlFileName:String) {
var homeSideBar:XML = new XML();
homeSideBar.ignoreWhite = true;
homeSideBar.onLoad = function (success) {
if (success) {
var root:XMLNode = this.firstChild;
for (i = 0; i < root.childNodes.length; i++) {
var titleItem:String = this.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
var imgItem = this.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
linkItem.push (this.firstChild.childNodes*.childNodes[2].firstChild.nodeValue);
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
sideBar_mc.thumbnailsHolder_mc.attachMovie("thumbnailModule_mc", "thumbnailModule_mc"+i,i);
if (i ==0){
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i]._y = 0;
} else {
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i]._y = i * 102;
}
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].thumbnailTitle_mc.title_txt.text = titleItem;
thumbListener.onLoadInit = function (target) {
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].circlepreloader_mc._alpha = 100;
}
thumbListener.onLoadProgress = function(target, bytesLoaded, bytesTotal) {
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].circlepreloader_mc._alpha = 100;
trace("loading");
}
thumbListener.onLoadComplete= function(target) {
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].circlepreloader_mc._alpha = 0;
trace("complete");
}
thumbLoader.loadClip(imgItem, sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].imgHolder_mc);
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].hit_btn.ID = i;
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].hit_btn.onRollOver = function() {
this._parent.overlay_mc.tween("_x", 245, .25, "easeOutQuad");
this._parent.thumbnailTitle_mc.tween("_x", 240, .25, "easeOutQuad");
this._parent.gotoAndPlay("over");
}
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].hit_btn.onRollOut = function() {
this._parent.overlay_mc.tween("_x", 1, .25, "easeOutQuad");
this._parent.thumbnailTitle_mc.tween("_x", 1, .25, "easeOutQuad");
this._parent.gotoAndPlay("out");
}
sideBar_mc.thumbnailsHolder_mc["thumbnailModule_mc" + i].hit_btn.onRelease = function() {
var btnInstance:Number = this.ID;
//the variable btnInstance is then used at the index
trace(linkItem[btnInstance]);
}
checkScroll(sideBar_mc.scrollBar_mc,sideBar_mc.thumbnailsHolder_mc,Stage.height);
}
}
}
homeSideBar.load (xmlFileName);
}
loadHomeBar("xml/sidebar_home.xml");