Legacy Documentation: Version 4.5
Previous
Example: Browser JavaScript Communication
Next
Example: Flash Vars

Example: Accessing the Stage

You can access the Flash Stage from your C#/JS scripts in the following way:

ActionScript.Import("com.unity.UnityNative"); 
ActionScript.Statement("trace(UnityNative.stage);");


As an example, the following C# code will output the flashvars supplied to a SWF:

ActionScript.Import("com.unity.UnityNative"); 
ActionScript.Statement(
    "var params:Object = LoaderInfo(UnityNative.stage.loaderInfo).parameters;" +
    "var key:String;" +
    "for (key in params) {" +
        "trace(key + '=' + params[key]);" +
    "}"
);


Previous
Example: Browser JavaScript Communication
Next
Example: Flash Vars