# Js \> as

**URL:** <https://forum.kirupa.com/t/js-as/191338>\
**Category:** Uncategorized\
**Created:** [June 19, 2006, 8:06pm UTC](https://forum.kirupa.com/t/js-as/191338 "2006-06-19T20:06:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greggeh](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Greggeh](https://forum.kirupa.com/u/Greggeh)\
**Post date:** [June 19, 2006, 8:06pm UTC](https://forum.kirupa.com/t/js-as/191338/1 "2006-06-19T20:06:13Z")

</div>

Ok, I know some of youre are fermiliar with loading JS variables into Flash  
The way I do it is like this:

```auto
 <script language="JavaScript">
function setPage(newPage) {
    if (window.document.content) {
        window.document.content.SetVariable("myHTMLvar", newPage);
    }
}
</script>

```

So Ive got a flash movie on the site named “content”. I get the variable “newPage” from a JS in an iframe which looks like this:

```auto
<script language="JavaScript">
    parent.setPage("lol"); 
</script>

```

Ok so far so clear.  
I use an empty MC in my flash movie with an onClipEvent(enterFrame) handler to check wether a variable is assigned or not.  
So this script keeps running every frame.

Now my question is if its possible to execute a function ONCE through JS. So i dont need the onClipEvent handler to check if a variable is assigned.

Does anyone how to solve this?
