import flash.display.BitmapData;import flash.geom.Point;import flash.geom.Rectangle;import flash.geom.ColorTransform;var bmpColor:BitmapData = BitmapData.loadBitmap("color_00.png"); // the color to paint withvar bmpWall:BitmapData = new BitmapData(480, 200, false, 0xc0c0c0); // a bmp to paint invar bMouseDown:Boolean = false;var iPaint:Number = 0; // "color on brush"this.onEnterFrame = function ():Void { var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png"); // the "brush" var iPosX:Number = this._xmouse - (bmpAlpha.width * 0.5); var iPosY:Number = this._ymouse - (bmpAlpha.height * 0.5); if (bMouseDown) { // modify alpha ... bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, iPaint)); bmpWall.copyPixels(bmpColor, bmpAlpha.rectangle, new Point(iPosX, iPosY), bmpAlpha, new Point(0,0), true); this.attachBitmap(bmpWall, 0); // show ... (not the best way, imho ...) // Disolve paint ... iPaint -= 5; if (iPaint <= -250) { iPaint = 0; // just resti t } }}this.onMouseDown = function ():Void { bMouseDown = true;}this.onMouseUp = function ():Void { bMouseDown = false;}
Powered by: newtelligence dasBlog 1.9.6264.0
Disclaimer The opinions expressed herein are our personal opinions and do not represent our customer's view in anyway.
© Copyright 2009, gaming your way
E-mail