function process(e:Event):void {
TweenLite.to(bkg, 1, {alpha: .3});
TweenLite.to(gal0,1, {alpha:.3});
TweenLite.to(gal1,1, {alpha:.3});
TweenLite.to(gal2,1, {alpha:.3});
TweenLite.to(gal3,1, {alpha:.3});
TweenLite.to(gal4,1, {alpha:.3});
addChild(thumbHolder);
myXML = new XML(e.target.data);
total = myXML.Gallery[galNum].Image.length();
for (var i:int = 0; i < total; i++) {
picLoc = myXML.Gallery[galNum].Image*.@picURL;
var thumbLoc:String = myXML.Gallery[galNum].Image*.@thumb;
var picLoader = new Loader();
var thumbLoader = new Loader();
thumbLoader.name = i;
thumbLoader.x =(thumbLoader.width + 55) * i;
thumbLoader.y = 500;
thumbWidth = thumbLoader.x + 55;
thumbLoader.name = i;
thumbLoader.load(new URLRequest(thumbLoc));
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadThumbs);
thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadThumbs2);
}
}
function loadThumbs(event:ProgressEvent):void {
var percent:Number = Math.round((event.bytesLoaded/event.bytesTotal) * 100 );
trace(percent);
}
function loadThumbs2(event:Event):void {
// this right here is causing the problem. When I have it in the process //function, it works just fine.
thumbHolder.addChild(thumbLoader);
/*testArray.push(thumbLoader);
thumbHolder.x = (stage.width - thumbWidth) / 2;
thumbHolder.alpha = 0;
TweenLite.to(thumbHolder, 3, {alpha: 1});
//thumbHolder.addEventListener(MouseEvent.CLICK, gallerySet);
thumbHolder.addEventListener(MouseEvent.MOUSE_OVER, gallerySet2);
thumbHolder.addEventListener(MouseEvent.MOUSE_OUT, fade);
picLoader.load(new URLRequest(picLoc));
*/
}
Im getting an error saying that the loader is null that i am trying to add to the stage. I dont know why. all I am trying to do is make a preloader, and its causing more of a headache than its worth can anyone assist me in trying to figure this out.
All I want it to do is show the percentage of loaded. I have the event.complete listener there to go add the thumbnails once they are fully loaded.