# How can i pass variables from JavaScript to AS3 AFTER my page has already loaded?

**URL:** <https://forum.kirupa.com/t/how-can-i-pass-variables-from-javascript-to-as3-after-my-page-has-already-loaded/257844>\
**Category:** Uncategorized\
**Created:** [April 17, 2008, 4:30pm UTC](https://forum.kirupa.com/t/how-can-i-pass-variables-from-javascript-to-as3-after-my-page-has-already-loaded/257844 "2008-04-17T16:30:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vesper8](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@vesper8](https://forum.kirupa.com/u/vesper8)\
**Post date:** [April 17, 2008, 4:30pm UTC](https://forum.kirupa.com/t/how-can-i-pass-variables-from-javascript-to-as3-after-my-page-has-already-loaded/257844/1 "2008-04-17T16:30:36Z")

</div>

[LEFT]Hi all…

With AS2 I could do this by simply setting variables in JS like this :

```auto

 
window.document.movie.SetVariable("passedVar1", 17);
 

```

And then in my flash I would listen for a change in that specific variable using :

```auto

onClipEvent (enterFrame) {
myTextField.text = _root.passedVar1;
}

```

And this worked fine. Now with AS3 it doesn’t work at all. I’ve been reading and trying to find a solution and I can’t seem to find any progress!

I already know how to pass variables to my flash at runtime, that isn’t a problem at all. But I want to trigger events using html elements such as buttons or links with onclick commands that will send a command to my flash via javascript. So I need to figure out how to do that, and also how to create a listener that actively listens for changes in certain variables and when it detects a change it can execute a function of my choosing.

Could anyone please spare me a few minutes of their time to explain how this can be achieved using Flash CS3 and AS3 ?

Thank you very much[/LEFT]
