In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

facebookのアイコン画像ロード→BitmapData.draw

level0用。
Get Adobe Flash player
by undo 25 Aug 2011
package
{
    
    import flash.display.*;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;

    [SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]
    public class ASTest extends Sprite
    {
        
        private var _loader:Loader;
        private var _context:LoaderContext;
        
        public function ASTest()
        {
            this.addEventListener(Event.ADDED_TO_STAGE, init);
        }
        private function init(evt:Event = null):void
        {
            _loader = new Loader();
            _context = new LoaderContext(true);
            
            var req:URLRequest = new URLRequest('http://graph.facebook.com/undo0530/picture');
            _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComp);
            _loader.load(req, _context);
            addChild(_loader);
        }
        private function onComp(evt:Event):void
        {
            var bmd:BitmapData = new BitmapData(_loader.width, _loader.height);
            bmd.draw(_loader);
            var bmp:Bitmap = new Bitmap(bmd);
            addChild(bmp);
            bmp.x = _loader.width;
        }
    }
}