# Frame rate problem

**URL:** <https://forum.kirupa.com/t/frame-rate-problem/318383>\
**Category:** Uncategorized\
**Created:** [January 18, 2011, 5:46pm UTC](https://forum.kirupa.com/t/frame-rate-problem/318383 "2011-01-18T17:46:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![outback](https://avatars.discourse-cdn.com/v4/letter/o/9f8e36/32.png) [@outback](https://forum.kirupa.com/u/outback)\
**Post date:** [January 18, 2011, 5:46pm UTC](https://forum.kirupa.com/t/frame-rate-problem/318383/1 "2011-01-18T17:46:36Z")

</div>

Hi all,

I’m trying to change my background color through Flash so I created a code in my HTML and another on my FLA file.

my problem when I use

this.addEventListener… my frame rate goes crazy… (its supposed to be 24FPS and it turns to twice as fast)

here is my html (head) code:

```auto

<script language="JavaScript">
function changeBgColor(newBgColor)
{
    if (window.document && window.document.bgColor)
    {
        document.bgColor = newBgColor;
    }
}
</script>

```

here is my flash code:

```auto
 
var jsCall:String;

this.addEventListener(Event.ENTER_FRAME, bgChange);

function bgChange(e:Event):void{
    if ((meuCaminho.parameters.disc) == "bio"){
        jsCall = String(ExternalInterface.call("changeBgColor", "#B5A7C3")); 
    }
    if ((meuCaminho.parameters.disc) == "fil"){    
        jsCall = String(ExternalInterface.call("changeBgColor", "#CCE7D3")); 
    }
}

```

anyone any ideias?

my animation is on another swf that is loaded inside my main one!!

PLS hELP!!!
