flash on 2010-12-12

by wh0
see http://wonderfl.net/c/d8DH
contentLoaderInfo.bytes is always accessible

seems like it's been known for at least a year already
♥0 | Line 25 | Modified 2010-12-12 18:49:44 | MIT License
play

ActionScript3 source code

/**
 * Copyright wh0 ( http://wonderfl.net/user/wh0 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1b3g
 */

package {
    import flash.events.Event;
    import flash.events.UncaughtErrorEvent;
    import flash.net.URLRequest;
    import flash.display.Loader;
    
    import com.actionscriptbible.Example;
    public class FlashTest extends Example {
        
        private var l:Loader;
        
        public function FlashTest() {
            loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, function(e:UncaughtErrorEvent):void { trace(e.error); });
            
            l = new Loader();
            l.load(new URLRequest('http://www.istockphoto.com/file_thumbview_approve/14391763/2/istockphoto_14391763-lijiang-river.jpg'));
            l.y = 200;
            addChild(l);
            l.contentLoaderInfo.addEventListener(Event.COMPLETE, asdf);
            trace('loading...');
        }
        
        private function asdf(e:Event):void {
            trace('childAllowsParent: ' + l.contentLoaderInfo.childAllowsParent);
            trace('first byte: ' + l.contentLoaderInfo.bytes[0]);
            trace('accessing content:');
            l.content;
        }
        
    }
}