[help as2] Setting Variable via Javascript to AS2

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:


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

AS2:


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

HTML


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:


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,