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

copyPixelsのテスト

Get Adobe Flash player
by zahir 17 Nov 2010
    Embed
/**
 * Copyright zahir ( http://wonderfl.net/user/zahir )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/uR6V
 */

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.geom.Point;
    
    [SWF(width="465", height="465")]
    public class Main extends Sprite
    {
        
        private var s:Shape;
        private var g:Graphics;
        private var bmp:Bitmap;
        private var bd:BitmapData;
        
        public function Main()
        {
            g = ( s = new Shape() ).graphics;
            bd = new BitmapData( stage.stageWidth, stage.stageHeight, true, 0 );
            addChild( bmp = new Bitmap( bd ) );
            
            draw();
        }
        
        private function draw():void
        {
            g.beginFill( 0 , 0.8);
            g.drawCircle( 50,50, 50);
            g.endFill();
            
            var src:BitmapData = new BitmapData(s.width, s.height, true, 0);
            src.draw( s );
            
            bd.copyPixels( src, src.rect, new Point() );
            bd.copyPixels( src, src.rect, new Point(50,50) );
            bd.copyPixels( src, src.rect, new Point(100,100), null, null, true);
        }
    }
}