I know there is at least one other thread on this error, and I’ve overcome it before with the ADDED_TO_STAGE listener, but this time I can’t seem to get it to work
I have this function:
private function preload(e:Event):void
{
var preloader = e.target;
var bar = preloader.process;
bar.scaleX += (count / numphot - bar.scaleX) * 0.1;
if (bar.scaleX >= 0.95) {
bar.scaleX = 1;
//Fade out preloader
Tweener.addTween( preloader, { alpha:0,
time:1,
transition:"easeOutExpo",
onComplete:function():void {
//remove preloader ~ load complete
removeChild(preloader)
changeTo(startFrom);
// fade in screen, scroller, caption, tooltip
Tweener.addTween([container, iScroller, cap, prevbut, nextbut], {alpha:1, time:2});
state = true;
}
});
// remove Enterframe event for preloader
preloader.removeEventListener(Event.ENTER_FRAME, preload);
}
}
Which is called by this, first time around:
preloaderMain.addEventListener(Event.ENTER_FRAME, preload);
and then later on, when I’ve removed all the items from the scene and want to restart everything again, using this:
preload(null);
According to the debug console, this is what is causing the error:
var preloader = e.target;
Any ideas?