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: BitmapDataSample1

Get Adobe Flash player
by goro 03 Jan 2010
/**
 * Copyright goro ( http://wonderfl.net/user/goro )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bkfa
 */

// forked from nutsu's BitmapDataSample1
package {
    
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    
    [SWF(backgroundColor=0)]
    public class BitmapDataSample1 extends Sprite {
        
        private var bmpdata:BitmapData;
        private var sprite:Sprite;
        
        public function BitmapDataSample1() {
            //BitmapDataを作成して表示リストに追加
            bmpdata = new BitmapData( 465, 465, false, 0 );
            addChild( new Bitmap(bmpdata) );
            //グラフィックの作成
            sprite = newFig( 232, 232, 300, 0xFFFFFF );
            //BitmapDataへ描画
            bmpdata.draw( sprite );
        }
        
        private function newFig( cx:Number, cy:Number, size:Number, col:uint ):Sprite {
            //中心(cx,cy), 幅高さsize, 色col のグラフィックを生成
            var shape:Sprite = new Sprite();
            shape.graphics.lineStyle( 0, 0x000000, 0.3 );
            shape.graphics.beginFill( col );
            shape.graphics.drawCircle( cx, cy, size*0.5 );
            shape.graphics.drawCircle( cx, cy, size*0.4 );
            var w:Number = size * 0.6;
            var h:Number = size * 0.15;
            shape.graphics.drawRect( cx - w/2, cy - h/2, w, h );
            shape.graphics.endFill();
            return shape;
        }
    }
}