Hi All,
I am creating a rotating banner. I have a loader swf file which I unload and load with the the new swf file every 15 seconds using set interval. It's going ape shit though and I am not sure what is causing this. Could someone please have a look at my logic and let me know where I am going wrong please?
Many thanks!
var navArr:Array = new Array();
navArr[0] = {btnName:slideButton1_btn, swf:"animationSlide1.swf"};
navArr[1] = {btnName:slideButton2_btn, swf:"animationSlide2.swf"};
navArr[2] = {btnName:slideButton3_btn, swf:"animationSlide3.swf"};
navArr[3] = {btnName:slideButton4_btn, swf:"animationSlide4.swf"};
var swfNumber:Number = 0;
function func_autoRotate ()
{
clearTimer();
loader_mc._alpha = 0;
loader_mc.unloadMovie();
if (firstRun)
{
swfNumber = 1;
firstRun = false;
}
if (swfNumber >= 4)
{
swfNumber = 0;
}
trace("swfNumber :" + swfNumber);
loader_mc.loadMovie(navArr[swfNumber].swf);
preloader_mc.onEnterFrame = function ()
{
if (loader_mc.getBytesLoaded() == loader_mc.getBytesTotal())
{
TweenLite.to(loader_mc, 1, {_alpha:100});
delete this.onEnterFrame;
}
}
startTimer ();
swfNumber ++;
}
function startTimer ()
{
//trace("startTimer");
var autoRotate = setInterval(func_autoRotate,7000);
}
startTimer ();
function clearTimer()
{
clearInterval(autoRotate);
//trace("clearTimer");
}
loader_mc.loadMovie("animationSlide1.swf");
preloader_mc.onEnterFrame = function ()
{
if (loader_mc.getBytesLoaded() == loader_mc.getBytesTotal())
{
delete this.onEnterFrame;
gotoAndStop(2);
}
}