Hi kirupaworld!
Been pulling out my hair over a preloader today. These things usually seem to go off without a hitch, but today the tables have turned on me.
This is my first preloader using setInterval (and its also my first easing preloader).
code looks a little like this:
var loadingClip:MovieClip = this;
function preLoader(bar:MovieClip,targetClip:MovieClip, targetWidth:Number){
var percent:Number = targetClip.getBytesLoaded()/targetClip.getBytesTotal();
var dummy:Number = targetWidth*percent;
trace(targetClip)
bar._width += (dummy-bar._width)/4;
if(bar._width>=targetWidth-1){
clearInterval(picLoader);
targetClip.play();
}
updateAfterEvent();
}
picLoader = setInterval(preLoader,25, pics.loaderBar, loadingClip , 154);
stop();
From my limited experience with setInterval, I have found that being literal is always better than being vague so i tried to be as explicit as possible in my function. The movieClip is 2 frames. The first frame is the preloader and the second frame is a movieClip containing a picture. (I attached the fla just in case).
Troubleshooting this, I found that tracing ‘targetClip’ outputs _level0, tracing percent (and simulating download) waits till the clip is downloaded and then traces 1. :?
Any ideas on what the glitch may be?
Thanks very much in advance!
ktz