Example: Accessing the Stage
Manual     Reference     Scripting   
Unity Manual > Getting Started with Flash Development > Example: Accessing the Stage

Example: Accessing the Stage

Unity 3.5.2 added the ability to access the Stage from your C#/JS scripts:

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("flash.display.LoaderInfo"); 	
ActionScript.Statement(
    "var params:Object = LoaderInfo(UnityNative.stage.loaderInfo).parameters;" +
    "var key:String;" +
    "for (key in params) {" +
        "trace(key + '=' + params[key]);" +
    "}"
);


Note: The Flash export feature is currently available as a developer preview. This feature is still in development and thus the above information is subject to change.

Page last updated: 2012-05-18