# Resetting a Variable

**URL:** <https://forum.kirupa.com/t/resetting-a-variable/179613>\
**Category:** flash\
**Created:** [February 21, 2006, 7:42pm UTC](https://forum.kirupa.com/t/resetting-a-variable/179613 "2006-02-21T19:42:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saveth](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@saveth](https://forum.kirupa.com/u/saveth)\
**Post date:** [February 21, 2006, 7:42pm UTC](https://forum.kirupa.com/t/resetting-a-variable/179613/1 "2006-02-21T19:42:09Z")

</div>

I’ve been trying to reset my rotateImage function if it hits 5\_mc in the array

I have the array items with actionscript linkage to 1,2,3,4,5

Any ideas on how to do this?

Thanks,  
Saveth

```auto

// NUMBER OF BANNERS
var countbanners = 5;

// DEFINE BANNER ARRAY
filenamebanners = ["1_mc", "2_mc", "3_mc", "4_mc", "5_mc"];

// GET RANDOM BANNER
for (i=0; i<countbanners; i++) {
    s = filenamebanners.length;
    k = Math.floor(Math.random()*s);
    holder_mc.attachMovie([k], banner[k]+i, getNextHighestDepth());
    }
 
// FADE IN IMAGE
this.onEnterFrame = function() {
    if (holder_mc._alpha<100) {
        holder_mc._alpha += 10;
    }
};

rotateInterval = setInterval(rotateImage, 4000);

// ROTATE IMAGES
function rotateImage() {
    holder_mc._alpha = 0;
    holder_mc.attachMovie([k++], banner[k++]+i, getNextHighestDepth());
}

```
