package com.google.utils { import flash.utils.*; import flash.system.*; import flash.display.*; public class SafeLoader extends Loader { public static var uncaughtErrorEventHandler:Function; public function SafeLoader(){ if (((!((uncaughtErrorEventHandler == null))) && (hasOwnProperty("uncaughtErrorEvents")))){ Object(this).uncaughtErrorEvents.addEventListener("uncaughtError", uncaughtErrorEventHandler, false, -1); }; } override public function loadBytes(_arg1:ByteArray, _arg2:LoaderContext=null):void{ throw (new SecurityError()); } } }//package com.google.utils package com.google.youtube.application { import flash.events.*; import flash.utils.*; import flash.system.*; import flash.display.*; import com.google.utils.*; import flash.net.*; import flash.external.*; public dynamic class SwfProxy extends Sprite { protected var player:String = ""; protected var enableJsApi:Boolean = false; protected var loader:Loader; public function SwfProxy():void{ var vars:* = null; var workaround:* = null; super(); Security.allowDomain("*"); vars = describeType(root).metadata.(@name == "Params").arg; this.enableJsApi = (((loaderInfo.parameters.enablejsapi == "1")) || ((vars.(@key == "enablejsapi").@value == "1"))); this.player = vars.(@key == "swf").@value; this.addExternalCallback("addEventListener", this.addExternalEventListener); loaderInfo.addEventListener(Event.INIT, this.onInit); workaround = new Proxy(); workaround = null; } protected function addExternalEventListener(_arg1:String, _arg2:String, _arg3:Boolean=false):void{ var eventType:* = _arg1; var functionName:* = _arg2; var useCapture:Boolean = _arg3; addEventListener(eventType, function (_arg1:Event):void{ ExternalInterface.call(functionName, ((_arg1.hasOwnProperty("data")) ? Object(_arg1).data : null)); }); } protected function onAddCallback(_arg1:Event):void{ this[Object(_arg1).functionName] = Object(_arg1).closure; this.addExternalCallback(Object(_arg1).functionName, Object(_arg1).closure); } protected function onLoaderInit(_arg1:Event):void{ addChild(this.loader); } protected function onInit(_arg1:Event):void{ var event:* = _arg1; this.loader = new SafeLoader(); this.loader.contentLoaderInfo.addEventListener(Event.INIT, this.onLoaderInit); this.loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onLoaderError); this.loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onLoaderError); this.loader.contentLoaderInfo.sharedEvents.addEventListener("ADD_CALLBACK", this.onAddCallback); this.loader.contentLoaderInfo.sharedEvents.addEventListener("EXTERNAL", this.onExternalEvent); try { this.loader.load(new URLRequest(this.player), new LoaderContext(false)); } catch(e:SecurityError) { onLoaderError(new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR, false, false, e.message)); }; } protected function onExternalEvent(_arg1:Event):void{ dispatchEvent(Event(Object(_arg1).data)); } protected function addExternalCallback(_arg1:String, _arg2:Function):void{ var functionName:* = _arg1; var closure:* = _arg2; if (((this.enableJsApi) && (ExternalInterface.available))){ try { ExternalInterface.addCallback(functionName, closure); } catch(e:SecurityError) { }; }; } protected function onLoaderError(_arg1:ErrorEvent):void{ dispatchEvent(new ErrorEvent("onError")); } } }//package com.google.youtube.application