/ Published in: ActionScript 3
Note: This example uses Arthropod Debugger (AIR App) which can be downloaded from here http://arthropod.stopp.se/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { import flash.display.Sprite; import flash.events.Event; import flash.display.LoaderInfo; import com.carlcalderon.arthropod.Debug; public class TraceFlashVars extends Sprite { public function TraceFlashVars():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); Debug.clear(); // Trace out all the FlashVars Debug.log("-- FLASHVARS --------------------------------"); var keyStr:String; var valueStr:String; //var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; var paramObj:Object; paramObj = loaderInfo.parameters; //////////////////////////////////////////////////////////////////////////// // This is work workaround for accessing FlashVars when using a TLFTextField if (parent != null && parent.parent != null) { paramObj = parent.parent.loaderInfo.parameters; } //////////////////////////////////////////////////////////////////////////// var numOfFlashVars:int = 0; for (keyStr in paramObj) { valueStr = String(paramObj[keyStr]); Debug.log(keyStr + ": " + valueStr); numOfFlashVars++; } Debug.log("---------------------------------------------"); if (numOfFlashVars == 0) { Debug.log("No FlashVars were found!"); } else { Debug.log(numOfFlashVars+" FlashVars were found."); } } } }
URL: http://www.adrianparr.com/?p=137