Legacy Documentation: Version 4.6
Language: English
Example: Browser JavaScript Communication
Example: Flash Vars

Example: Accessing the Stage

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

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]);" +
    "}"
);


Example: Browser JavaScript Communication
Example: Flash Vars