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

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

// forked from hacker_n96o8lrr's forked from: BitmapDataSample1
// forked from nutsu's BitmapDataSample1
package {
    
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    
    [SWF(width=465,height=465,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, 0xFFFF00 );
            //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.beginFill( col );
            shape.graphics.drawCircle( cx, cy, size*0.7 );
            shape.graphics.drawCircle( cx, cy, size*0.5 );
            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;
        }
    }
}