# Random frame displays the background color

**URL:** https://forum.kirupa.com/t/random-frame-displays-the-background-color/307925
**Category:** Uncategorized
**Created:** [April 13, 2010, 4:46pm UTC](https://forum.kirupa.com/t/random-frame-displays-the-background-color/307925 "2010-04-13T16:46:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![IndustrialJones](https://avatars.discourse-cdn.com/v4/letter/i/c68b51/32.png) [@IndustrialJones](https://forum.kirupa.com/u/IndustrialJones)
#### Post date: [April 13, 2010, 4:46pm UTC](https://forum.kirupa.com/t/random-frame-displays-the-background-color/307925/1 "2010-04-13T16:46:28Z")

</div>

Everything works like I want when I test it in Flash, but when I publish it and view in html, the first frame comes up fine, but all other frames display the background color (white). Whenever it loads I have it set to go to a random frame (1-8) and in each frame is a simple movie clip that just tweens the brightness from -100% to 0% (black to normal).  
Below is the actionscript I have in the first frame.

```auto
var r:Number = Math.floor(Math.random()*7)+1;

_root.onLoad=function(){
this.gotoAndStop(r)
}

stop();

btn_next.onRelease = function () {
   if (_root._currentFrame == 8) {
       gotoAndStop(1)
   }
   else {
      nextFrame();
   }
}

btn_prev.onRelease = function () {
   if (_root._currentFrame == 1) {
       gotoAndStop(8)
   }
   else {
      prevFrame();
   }
}

```
