forked from: flash on 2011-8-17

by komatsu
♥0 | Line 24 | Modified 2011-08-18 01:01:20 | MIT License
play

ActionScript3 source code

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

// forked from takashifukasawa7's flash on 2011-8-17
package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.geom.*;    
    import flash.system.*;
    
    public class FlashTest extends Sprite {
        
        private var imgLoader:Loader;
        
        [swf(width = "480",height = "800")]
        
        public function FlashTest() {
            var context:LoaderContext = new LoaderContext(true);
            imgLoader= new Loader();
            imgLoader.load(new URLRequest("http://dh-flashlab.com/blog/wp-content/uploads/2011/08/hiragana.png"),context);
            imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,compFunc);
            //addChild(imgLoader);            
        }
         private function compFunc(e:Event):void
            {         
            var bmd:BitmapData = new BitmapData(imgLoader.width,imgLoader.height,true);
                 bmd.draw(imgLoader);
                 var bmObj:Bitmap = new Bitmap(bmd);
                 addChild(bmObj);
            }
        
    }
}