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

forked from: forked from: LoaderContext

LoaderContextを使うと、drawできるようになるよ。
ただし、crossdomain.xmlで許可されている場合だけだよ。

↓このファイルね。
http://farm4.static.flickr.com/crossdomain.xml
Get Adobe Flash player
by jmbyh521 08 Sep 2015
    Embed
/**
 * Copyright jmbyh521 ( http://wonderfl.net/user/jmbyh521 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6spa
 */

// forked from umhr's forked from: LoaderContext
// forked from umhr's LoaderContext
/*
 * 
 * LoaderContextを使うと、drawできるようになるよ。
 * ただし、crossdomain.xmlで許可されている場合だけだよ。
 * 
 * ↓このファイルね。
 * http://farm4.static.flickr.com/crossdomain.xml
 * */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.filters.DropShadowFilter;
    import flash.system.LoaderContext;
    [SWF(backgroundColor="0xCCCCCC")]
    public class Main extends Sprite {
        public function Main() {
            var myLoader:Loader = new Loader();
            myLoader.load(new URLRequest("http://farm1.static.flickr.com/131/379073685_559c26106a_m.jpg") , new LoaderContext(true));
            myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
        }
        private function onComplete(e:Event):void {
            var bitmap:Bitmap = e.target.content;
            var myBitmapData:BitmapData = new BitmapData(bitmap.width, bitmap.height);
            myBitmapData.draw(bitmap);
            var sp:Sprite = new Sprite();
            sp.graphics.beginBitmapFill (myBitmapData);
            sp.graphics.drawRoundRect( 50, 50 , 365, 365, 100, 100);
            sp.graphics.drawCircle(465/2, 465/2, 120);
            sp.graphics.drawCircle(465/2, 465/2, 100);
            sp.graphics.drawCircle(465/2, 465/2, 80);
            sp.graphics.drawCircle(465/2, 465/2, 60);
            sp.graphics.drawRoundRect(465/2-30,465/2-30,60,60,20,20);
            sp.filters = [new DropShadowFilter()];
            addChild(sp);
        }
    }
}