lib-flex-animation-code-01-BitmapCollision-BitmapCompare.ax (swf ) [ flash ] flex
package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.geom.Rectangle; public class @ax-lib-flex-animation-code-01-BitmapCollision-BitmapCompare extends Sprite { public function @ax-lib-flex-animation-code-01-BitmapCollision-BitmapCompare() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // draw a bunch of random lines graphics.lineStyle(0); for(var i:int = 0; i < 100; i++) { graphics.lineTo(Math.random() * 300, Math.random() * 400); } // create an opaque bitmap var bmpd1:BitmapData = new BitmapData(300, 200, false, 0xffffff); bmpd1.fillRect(new Rectangle(100, 50, 100, 100), 0xff0000); var bmp1:Bitmap = new Bitmap(bmpd1); addChild(bmp1); // create a transparent bitmap var bmpd2:BitmapData = new BitmapData(300, 200, true, 0x00ffffff); bmpd2.fillRect(new Rectangle(100, 50, 100, 100), 0x80ff0000); var bmp2:Bitmap = new Bitmap(bmpd2); bmp2.y = 200; addChild(bmp2); } }}
(C) Æliens 18/6/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.