ActionScript 3.0 ã§ããã£ã¹ãã¬ã¤ãªãã¸ã§ã¯ãããBitmapDataãåå¾ããã«ã¯ï¼
ã¤ã³ã¹ã¿ã³ã¹åããMovieClipãªã©ã®DisplayObjectããBitmapDataãåå¾ããã«ã¯ãdraw (BitmapData.draw ã¡ã½ãã)ã使ç¨ããã ãã®éãmatrixã«DisplayObjectã®ã¹ã±ã¼ã«æ å ±ã渡ããã¨ã§ãå¤å½¢å¾ã®BitmapDataãå¾ããã¨ãåºæ¥ãã
flash on 2013-11-21 - wonderfl build flash online
package { import flash.display.Bitmap; import flash.geom.Matrix; import flash.display.BitmapData; import flash.display.MovieClip; import flash.display.Sprite; public class FlashTest extends Sprite { public function FlashTest() { //DisplayObject ãä½æ var _mc:MovieClip = new MovieClip(); _mc.graphics.beginFill(0xFF0000); _mc.graphics.drawRect(0,0,24,24); _mc.graphics.endFill(); //[1]ãã¹ãã®ããã¹ã±ã¼ã«ã2åã«ãã _mc.scaleX = 2; _mc.scaleY = 2; //DisplayObject ã¨åããµã¤ãºã® BitmapData ãä½æ //ãããããããã¼ã¿1 var _bitmapData1:BitmapData = new BitmapData(_mc.width,_mc.height,false); //ãããããããã¼ã¿2 var _bitmapData2:BitmapData = new BitmapData(_mc.width,_mc.height,false); //DisplayObject ã®ã¹ã±ã¼ã«æ å ±ãåå¾ var _matrix:Matrix = new Matrix(); _matrix.scale(_mc.scaleX,_mc.scaleY); //BitmapData ã«æ¸ã込㿠//[2]ãããããããã¼ã¿1ã¯ãã®ã¾ã¾ _bitmapData1.draw(_mc); //[3]ãããããããã¼ã¿2ã«ã¯ãMatrixã渡ã _bitmapData2.draw(_mc,_matrix); //[4]ãããããããã¼ã¿1ã®æ¹ã¯ã[1]ã®ã¹ã±ã¼ã«ãåæ ãããä½ææã® DisplayObject ã®ãµã¤ãºã®ã¾ã¾ var bitmap1:Bitmap = new Bitmap(_bitmapData1); this.addChild(bitmap1); //[5]ãããããããã¼ã¿2ã®æ¹ã¯ã[1]ã®ã¹ã±ã¼ã«ãåæ ãã2åã®å¤§ããã§è¡¨ç¤ºããã var bitmap2:Bitmap = new Bitmap(_bitmapData2); bitmap2.x = 48;//ä½ç½®èª¿æ´ this.addChild(bitmap2); } } }