# \_root replacement / javascript to ActionScript

**URL:** https://forum.kirupa.com/t/-root-replacement-javascript-to-actionscript/280949
**Category:** flash
**Created:** [February 3, 2009, 10:36am UTC](https://forum.kirupa.com/t/-root-replacement-javascript-to-actionscript/280949 "2009-02-03T10:36:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MaGiCpt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@MaGiCpt](https://forum.kirupa.com/u/MaGiCpt)
#### Post date: [February 3, 2009, 10:36am UTC](https://forum.kirupa.com/t/-root-replacement-javascript-to-actionscript/280949/1 "2009-02-03T10:36:07Z")

</div>

Howdy,  
Im having a little problem making javascript communicate with actionScript, perhaps some expert advice might help me 😛  
Here is the problem, i have a application that uses javascript to communicate with SWF and pass it some values, and the code was working in AS2 with the following:

function xpto(key){  
var ctlPlanta;  
ctlPlanta = document.GetAxControl(“filme”);  
ctlPlanta.SetVariable("\_root.valor", key);  
}

in this example the aplication would pass key to the javascrip function and the function would put the value in the swf variable called \_root.valor.

So the problem is (as you already know) \_root has gone in AS3. And every thing i tryed so far seems not to work. every thing i read so far was to embeb the swf in the js and use  
root.loaderInfo.parameters.valor, well i dont want to use the embedSWF because i need to get the activeX cotnrol from my document.

Is there any \_root replacement? is anyway to get this to work at all ?

tks in advance.

Sincerely,  
Magic
