# Fading jpg array

**URL:** <https://forum.kirupa.com/t/fading-jpg-array/1926>\
**Category:** flash\
**Created:** [April 19, 2002, 2:02pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926 "2002-04-19T14:02:42Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [April 19, 2002, 2:02pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/1 "2002-04-19T14:02:42Z")

</div>

OK. So I used this code for creating an array with JPGs that automatically cycle and loop. Now I need to know how to, based on using this code, get the JPGs to fade-in/fade-out.

* * *

## \_root.onEnterFrame = function() { &nbsp &nbsp &nbsp &nbsp Time = getTimer(); &nbsp &nbsp &nbsp &nbsp timeToDisplay = 3;//image display time, in seconds &nbsp &nbsp &nbsp &nbsp delay = timeToDisplay_displayed;//calculates the display time &nbsp &nbsp &nbsp &nbsp iMax = 8;//total number of images to be displayed &nbsp &nbsp &nbsp &nbsp if (Time\>(delay_1000)) {//milli = 1000, 3\*1000 = 3 seconds &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (iNum\>iMax-1) { &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp iNum = 1; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp } else { &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp iNum++; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp } &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp displayed++; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp loadMovie(“image”+iNum+".jpg", “mcClip”); &nbsp &nbsp &nbsp &nbsp } };

Anyone have any ideas???

---

<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:** [April 21, 2002, 3:24am UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/2 "2002-04-21T03:24:07Z")

</div>

\_root.onEnterFrame = function (){  
\_root.myImage.\_alpha–;  
};

where ‘myImage’ is the name of the clip you want to fade out.  
there are so many ways to do what you are talking about, this is just among the most basic.  
🙂  
jeremy

---

<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:** [April 21, 2002, 11:58pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/3 "2002-04-21T23:58:29Z")

</div>

Thanks for your reply, Jeremy.

The only question I have is that, based on my code, the movie will not keep entering the frame. So the movie clip will only fade once based on the code you presented.

My code has the image timed to rotate within the array every 3 seconds and then loop. How do I get a fade-in/fade-out given this method?

---

<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:** [April 22, 2002, 4:40pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/4 "2002-04-22T16:40:21Z")

</div>

\_root.onEnterFrame = function() {  
&nbsp &nbsp &nbsp &nbsp if (!zInit) {  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp trace(“init”);  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.nCount = 0;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.zFlag = false;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.nTime = 0;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp zInit = true;  
&nbsp &nbsp &nbsp &nbsp }  
&nbsp &nbsp &nbsp &nbsp if (!\_root.zFlag) {  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp trace(“loading”);  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp loadMovieNum(\_root.aLoadThese[nCount]+".swf", 10);  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.nStart = getTimer();  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.nTime = 0;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.zFlag = true;  
&nbsp &nbsp &nbsp &nbsp }  
&nbsp &nbsp &nbsp &nbsp \_root.nTime = getTimer()-\_root.nStart;  
&nbsp &nbsp &nbsp &nbsp if (\_root.nTime\>2000 and \_root.nTime\<3000) {  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_level10.\_alpha-=4;  
&nbsp &nbsp &nbsp &nbsp } else if (nTime\>=3000) {  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.unloadMovieNum(10);  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.zFlag = false;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp trace(\_root.aLoadThese.length+"…"+\_root.nCount);  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (\_root.nCount\>=\_root.aLoadThese.length-1) {  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.nCount = 0;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp } else {  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.nCount++;  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }  
&nbsp &nbsp &nbsp &nbsp }  
};

and it works, i tested it. just create an array named ‘aLoadThese’ on the \_root timeline that holds the names of all the files (without the ‘.swf’ at the end).  
🙂  
jeremy

---

<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:** [April 23, 2002, 2:23pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/5 "2002-04-23T14:23:25Z")

</div>

How should that array look?

---

<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:** [April 23, 2002, 2:39pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/6 "2002-04-23T14:39:26Z")

</div>

Got it working! You da man!!! Thanks!!!

---

<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:** [April 23, 2002, 3:01pm UTC](https://forum.kirupa.com/t/fading-jpg-array/1926/7 "2002-04-23T15:01:29Z")

</div>

Now, anyone any ideas on how to add a separate URL for each different image based on this array?
