# \[help as2\] Setting Variable via Javascript to AS2

**URL:** https://forum.kirupa.com/t/help-as2-setting-variable-via-javascript-to-as2/202658
**Category:** flash
**Created:** [October 3, 2006, 3:45pm UTC](https://forum.kirupa.com/t/help-as2-setting-variable-via-javascript-to-as2/202658 "2006-10-03T15:45:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gone2far](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gone2far](https://forum.kirupa.com/u/gone2far)
#### Post date: [October 3, 2006, 3:45pm UTC](https://forum.kirupa.com/t/help-as2-setting-variable-via-javascript-to-as2/202658/1 "2006-10-03T15:45:23Z")

</div>

Hey People,

I’m stuck. I’ve tried all this afternoon trying to pass/set a variable from javascript to flash.

Basically i’m trying to pass a variable from the JS to Flash that is displayed in a textbox for testing functionality.

Javascript:

```auto

function PlayFlashMovie(trackUrl) {
    var flashMovie = getFlashMovieObject("player");
    
    flashMovie.SetVariable("/:qsurl", trackUrl);
}

```

AS2:

```auto

var qsurl:String;
...
_txt.text = qsurl;

```

HTML

```auto

onclick="PlayFlashMovie('foo');"

```

For some reason that doesn’t set the variable inside my flash movie to qsurl - it still remains undefined.

I’ve tried using “/:\_root.qsurl” and variants.

However, if i access the textfield directly using:

Javascript:

```auto

flashMovie.SetVariable("/:_txt.text", trackUrl);

```

That sets the textfield correctly. Obviously I don’t want to do it like, rather directly set the variable!

Also, i was wondering if this was an issue since I’m working with AS2 and not AS1 (all examples I’ve seen on the web are AS1 and Flash 4 based)?

Thanks,
