Changeset 60 for trunk/as3/com/jeroenwijering/player/SWFLoader.as
- Timestamp:
- 08/18/08 03:12:05 (5 years ago)
- File:
-
- 1 edited
-
trunk/as3/com/jeroenwijering/player/SWFLoader.as (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/as3/com/jeroenwijering/player/SWFLoader.as
r57 r60 26 26 /** Base directory for the plugins. **/ 27 27 private var basedir:String = 'http://plugins.longtailvideo.com/'; 28 /** Amount of plugins still to load. **/29 private var amount:Number;30 28 31 29 … … 37 35 public function SWFLoader(ply:MovieClip):void { 38 36 player = ply; 39 amount = 0;40 37 }; 41 38 … … 44 41 * Load a list of SWF plugins. 45 42 * 46 * @prm pgi A commaseparated list with plugins.43 * @prm pgi A commaseparated list with plugins. 47 44 **/ 48 45 public function loadPlugins(pgi:String=null):void { 49 46 if(pgi) { 50 47 var arr = pgi.split(','); 51 amount = arr.length;52 48 for(var i in arr) { loadSWF(arr[i],false); } 53 } else {54 dispatchEvent(new Event(Event.COMPLETE));55 49 } 56 50 }; … … 67 61 } else { 68 62 skin = player['player']; 69 dispatchEvent(new Event(Event. INIT));63 dispatchEvent(new Event(Event.COMPLETE)); 70 64 } 71 65 }; … … 79 73 ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,skinError); 80 74 ldr.contentLoaderInfo.addEventListener(Event.INIT,skinHandler); 81 } else { 75 } else { 82 76 skin.addChild(ldr); 83 77 ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,pluginError); 84 78 ldr.contentLoaderInfo.addEventListener(Event.INIT,pluginHandler); 85 79 } 86 if(player.loaderInfo.url.indexOf('http ://') == 0) {80 if(player.loaderInfo.url.indexOf('http') == 0) { 87 81 var ctx = new LoaderContext(true,ApplicationDomain.currentDomain,SecurityDomain.currentDomain); 88 82 if(skn) { … … 97 91 98 92 99 /** SWF loading failed ; use default skin. **/93 /** SWF loading failed. **/ 100 94 private function pluginError(evt:IOErrorEvent):void { 101 amount--; 102 if (amount == 0) { 103 dispatchEvent(new Event(Event.COMPLETE)); 104 } 95 player.view.sendEvent('trace',' plugin: '+evt.toString()); 105 96 }; 106 97 … … 108 99 /** Plugin loading completed; add to stage and populate. **/ 109 100 private function pluginHandler(evt:Event):void { 110 var clp= evt.target.content;111 player.addPlugin(clp);112 amount--;113 if (amount == 0) {114 dispatchEvent(new Event(Event.COMPLETE));101 var plg = evt.target.content; 102 try { 103 plg.initializePlugin(player.view); 104 } catch(err:Error) { 105 player.view.sendEvent('trace',' plugin: '+err.message); 115 106 } 116 107 }; … … 120 111 private function skinError(evt:IOErrorEvent=null):void { 121 112 skin = player['player']; 122 dispatchEvent(new Event(Event. INIT));113 dispatchEvent(new Event(Event.COMPLETE)); 123 114 }; 124 115 … … 131 122 Draw.clear(player); 132 123 player.addChild(skin); 133 dispatchEvent(new Event(Event. INIT));124 dispatchEvent(new Event(Event.COMPLETE)); 134 125 } else { 135 126 skinError();
Note: See TracChangeset
for help on using the changeset viewer.
