Hi all, I was wondering if someone could help me out here. I recently built a preloader using the MovieClipLoader object. I used the following events: OnLoadComplete, OnLoadProgress and onLoadStart.
I regestered my listeners etc and then I decided I wanted to get a bit fancy. So I decided that within the onLoadProgress I would add an"if" statement, this if statement would basically say if the loaded content equals 70 then animate the preloader graphic off the screen using tweening (very simple).
The onLoadProgress is continously called while the content is being loaded but it seems that it does not want to correctly excute my if condition. Anyone shed any light on my logic?
Here is the code for the onLoadProgress.
loadListener.onLoadProgress = function (target:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
trace("onLoadProgress");
txtLoaded.text = String (Math.floor (bytesLoaded / bytesTotal * 100)) + "% loaded";
mcProgress._xscale = bytesLoaded / bytesTotal * 100; // address the bar
if ((Math.ceil (bytesLoaded / bytesTotal * 100) == 70) && (mcProgress._y == 298) )
{
trace("INSIDE my If Statement");
var mcProgressTweenY:Tween = new Tween (mcProgress, "_y", Strong.easeOut, 298, 328, 2, true);
TransitionManager.start (mcProgress,{type:Fade, direction:Transition.OUT, duration:1, easing:None.easeNone});
}
};