How to pass variables from .fla file to .as file in as3
I have a .fla file names test.fla and I have this variable in it:
var my_var;
stage.addEventListener(MouseEvent.CLICK, onLoaded);
function onLoaded(e:Event):void
{
my_var = "myVariable";
//trace(my_var);
}
I have a .as file called Main.as.
I want to pass **my_var** from test.fla to the Main.as.
I will really appreciate, if you can help me in this matter!
It is noticeable that I have used the method mentioned in "http://stackoverflow.com/questions/9603049/actionscript-3-pass-a-variable-from-the-main-fla-to-external-as-file", but it does not work for me!!!
I wrote in my Main.as:
package
{
public class Main extends Sprite
{
public function Main()
{
trace(root.my_var);
}
}
}
Thanks in advance!