flash on 2012-3-20 wh0 forked:0favorite:0lines:38license : MIT License modified : 2012-04-24 09:36:33 Embed Tweet package { import flash.display.*; import flash.events.*; import flash.net.*; import flash.utils.*; import com.actionscriptbible.Example; public class FlashTest extends Example { private static const RESOURCE:String = 'http://0:9988/garply.png'; private var flow:Number = 0; public function FlashTest() { loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, function (e:UncaughtErrorEvent):void { trace('UNCAUGHT_ERROR\t' + e.error); }); startRequest(); } private function startRequest():void { var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, function (e:Event):void { addResult('COMPLETE ' + e.target.bytes.length + '/' + e.target.bytesLoaded, e); trace(xd(e.target.bytes, 66)); }); l.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void { addResult('IO_ERROR', e); trace(e.target.bytes.length); }); l.load(new URLRequest(RESOURCE)); } private function xd(ba:ByteArray, n:int):String { var x:String = ''; for (var i:int = 0; i < 62; i++) { var b:int = ba[i]; x += b >= 32 && b <= 126 ? String.fromCharCode(b) : '.'; } return x; } private function addResult(result:String, event:Event):void { trace(result + '\t' + event); } } } Code Fullscreen Preview Fullscreen private IOErrorEvent.IO_ERROR String