Thursday, December 13, 2007

Flash dynamic Fade actionscript



slides_array = new Array
(
"swf/automated.swf",
"swf/buyNow.swf",
"swf/easy1.swf",
"swf/money.swf"

)

random_effects = new Array
(
"zoomin",
"zoomout",
"pan_right",
"pan_left"
)

trace(slides_array[0]);
slideNum = 0;
change_out_time = 5000;
fade_speed = 50;
slideLoaded = false;

trace( slides_array.length )


loadSlide();
function loadSlide()
{
loadMovie(slides_array[slideNum], window);
//call_changeout();
}
call_changeout();
function call_changeout()
{
fade_out_interval = setInterval(call_fade_out_Slide, change_out_time);
}

function call_fade_out_Slide()
{
fade_out_interval = setInterval(fade_out_Slide, fade_speed);
trace("call_fade_out called");
}

function fade_out_Slide()
{
trace(slideNum + " should fade");
if(window._alpha > 0)
{
window._alpha -= 5;
}
else
{
clearInterval(fade_out_interval);
call_nextSlide();
}
}


function call_nextSlide()
{
trace("call_nextSlide working");
if(slideNum < slides_array.length -1)
{
slideNum++;
}
else
{
slideNum = 0;
}
loadSlide();
window._alpha = 100;
}

No comments: