# Random banner with fade out mask

**URL:** https://forum.kirupa.com/t/random-banner-with-fade-out-mask/94575
**Category:** Uncategorized
**Created:** [November 14, 2003, 5:35am UTC](https://forum.kirupa.com/t/random-banner-with-fade-out-mask/94575 "2003-11-14T05:35:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![norm1252003](https://avatars.discourse-cdn.com/v4/letter/n/977dab/32.png) [@norm1252003](https://forum.kirupa.com/u/norm1252003)
#### Post date: [November 14, 2003, 5:35am UTC](https://forum.kirupa.com/t/random-banner-with-fade-out-mask/94575/1 "2003-11-14T05:35:03Z")

</div>

I am going out of my mind… I am trying to recreate this effect so i can modify it towards my design… the website that best illustrates the banner effect that I am trying to achieve is [www.dnastudio.com](http://www.dnastudio.com). I have created the mask that fades the front image out, but i have no clue how to loop the MC so that the random image will fade out. If anyone knows how to do this, please help me. I am working with flash 5. The script that i am using for the random image is:

onClipEvent (load) {  
this.gotoAndStop(Math.ceil(Math.random()\*this.\_totalframes));  
}

I have a MC with all of my images in it. Also, I have a MC called banner that contains the moving bars and fade out mask in it… the problem i am having is looping the random MC. Can someone please help…

lost in flash

norm1252003

---

<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: [November 14, 2003, 6:12am UTC](https://forum.kirupa.com/t/random-banner-with-fade-out-mask/94575/2 "2003-11-14T06:12:42Z")

</div>

Try something like this:

```auto
onClipEvent (load) {
	var change = 5000;
	var start = getTimer();
	gotoAndStop(Math.floor(Math.random()*_totalframes)+1);
}
onClipEvent (enterFrame) {
	if (getTimer()-start>=change) {
		var frame = _currentframe;
		while (frame == _currentframe) {
			gotoAndStop(Math.floor(Math.random()*_totalframes)+1);
		}
		start = getTimer();
	}
}

```

The value of the variable _change_ is the amount (in milliseconds) of time to wait before sending the playhead to a new frame. 🙂
