# Timer image swap with alpha fade in/out

**URL:** <https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001>\
**Category:** flash\
**Created:** [July 29, 2003, 6:05am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001 "2003-07-29T06:05:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![1111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/1111/32/206_2.png) [@1111](https://forum.kirupa.com/u/1111)\
**Post date:** [July 29, 2003, 6:05am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/1 "2003-07-29T06:05:11Z")

</div>

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.  
=)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 6:18am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/2 "2003-07-29T06:18:11Z")

</div>

check out this link… this will help you to understand the timing in flash…  
[http://www.kirupa.com/developer/actionscript/digital\_clock.htm](http://www.kirupa.com/developer/actionscript/digital_clock.htm)

e.s.x.s

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 6:21am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/3 "2003-07-29T06:21:40Z")

</div>

Thanx esxs, i have already scoured that source. I will keep hunting. I have also the random image stuff working. … cheers tho

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 6:35am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/4 "2003-07-29T06:35:29Z")

</div>

u r welcome .:®:. 🙂 if you want help about the AS that u need,i’m here…😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 8:05am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/5 "2003-07-29T08:05:52Z")

</div>

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? 🅱

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 9:33am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/6 "2003-07-29T09:33:34Z")

</div>

i think, this is want you want:  
[AS]  
square.\_alpha = 0;  
mypic = 1;  
\_root.onEnterFrame = function() {  
loadMovie(“images/image” + mypic + “.jpg”, “square”)  
fadeOut=false;  
fadeIn=true;  
message.text=mypic;

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

```

};[/AS]

e.s.x.s

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 9:45am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/7 "2003-07-29T09:45:13Z")

</div>

hey Thanks!

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2003, 9:55am UTC](https://forum.kirupa.com/t/timer-image-swap-with-alpha-fade-in-out/27001/8 "2003-07-29T09:55:25Z")

</div>

i just wrote the code for the periodically change and loop;) didn’t change the other parts of the code…  
u r welcome again, .:®:.😉
