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

BitmapDataSample2

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

// forked from nutsu's BitmapDataSample1
package {
    
    import flash.display.Sprite;
    
    [SWF(width=465,height=465,backgroundColor=0)]
    public class BitmapDataSample2 extends Sprite {
        
        private var sprite:Sprite;
        
        public function BitmapDataSample2() {
            //グラフィックの作成
            sprite = newFig( 232, 232, 300, 0xFFFFFF );
            //表示リストへ追加
            addChild( 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;
        }
    }
}