flash on 2011-4-18

by yprops
♥0 | Line 24 | Modified 2011-04-18 16:12:26 | MIT License
play

ActionScript3 source code

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

package {
    import flash.system.LoaderContext;
    import flash.net.URLRequest;
    import flash.display.LoaderInfo;
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.*;
    
    public class FlashTest extends Sprite {
        
        private var ld :Loader;
        public function FlashTest() {
            
            ld = new Loader();
            var req :URLRequest = new URLRequest("http://wonderfl.net/img/common/img_user_anonymous.gif");
            ld.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
            ld.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
            ld.load(req);
            //出力パネル?にBitmapData.drawのエラーが出るが、これはwonderflのサムネイル作成時のもの。本稿に直接関係するものではない。
        }
        private function onError(ev:Event) :void{
            trace("onError");
        }
        private function onLoad(ev:Event) :void{
            addChild(ld);
        }

        
    }
    
}