PDA

View Full Version : Timer image swap with alpha fade in/out



.:®:.
July 29th, 2003, 02:05 AM
I am chasing a good tutorial on an image swap via timer. ( i dont want to tween).

I just want to cycle around 10 small images, show for about 15 seconds then fade out/in the next image..

If anyone knows a good link for a tute on this I would really appreciate it.
=)

e.s.x.s
July 29th, 2003, 02:18 AM
check out this link.. this will help you to understand the timing in flash..
http://www.kirupa.com/developer/actionscript/digital_clock.htm

e.s.x.s

.:®:.
July 29th, 2003, 02:21 AM
Thanx esxs, i have already scoured that source. I will keep hunting. I have also the random image stuff working. ...... cheers tho

e.s.x.s
July 29th, 2003, 02:35 AM
u r welcome .:®:. :) if you want help about the AS that u need,i'm here..;)

.:®:.
July 29th, 2003, 04:05 AM
getting there..Okay, ihave the following code. This works great, but i want to extend the fade time and hopefully loop.:

square._alpha=0;
mypic=1;
// script causes slides to advance automatically every 5 seconds – no start button it just plays

_root.onEnterFrame = function()
{
if (square._alpha < 10)
{
loadMovie("images/image" + mypic + ".jpg", "square")
fadeOut=false;
fadeIn=true;
message.text=mypic;
}

if (square._alpha > 10 && fadeOut)
{
square._alpha -= 10;
}

if (square._alpha < 100 && fadeIn && !fadeOut)
{
square._alpha += 10;
}
else
{
fadeIn=false;
}

if (mypic>=10)
{
mypic=1
startTimeSet=0;
}

if (getTimer() > 5000 && mypic < 10 && !fadeIn && !fadeout && mypic==1)
{
fadeout=true;
mypic=2;
}

if (getTimer() > 10000 && mypic < 10 && !fadeIn && !fadeout && mypic==2)
{
fadeout=true;
mypic=3;
}

if (getTimer() > 15000 && mypic < 10 && !fadeIn && !fadeout && mypic==3)
{
fadeout=true;
mypic=4;
}
// continue to add if statements for every image in the series mypic==4, 5, 6, 7 etc.
}

any suggestions?.....pleeeeeeeeze? :b:

e.s.x.s
July 29th, 2003, 05:33 AM
i think, this is want you want:

square._alpha = 0;
mypic = 1;
_root.onEnterFrame = function() {
loadMovie("images/image" + mypic + ".jpg", "square")
fadeOut=false;
fadeIn=true;
message.text=mypic;

if (square._alpha>10 && fadeOut) {
square._alpha -= 10;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
if (mypic>=10) {
mypic = 1;
startTimeSet = 0;
lastTimer = getTimer();
}
if ((getTimer()-lastTimer)>(5000*mypic) && mypic<10 && !fadeIn && !fadeout) {
fadeout = true;
mypic += 1;
}
};

e.s.x.s

.:®:.
July 29th, 2003, 05:45 AM
hey Thanks!

It didn't show the pics, but will look into it more...
Nice code m8!... cheers

e.s.x.s
July 29th, 2003, 05:55 AM
i just wrote the code for the periodically change and loop;) didn't change the other parts of the code..
u r welcome again, .:®:.;)