Hello, long time reader, first time contributer here.
I am trying to mimic a paint brush in AS3. Right now I am simply checking for mouse down + mouse move then putting a copy of an image on the stage. This sucks because after a while it starts to get bogged down.
As a result I checked out graphics.lineBitmapStyle(), I was able to get that to work (technically) but not how I wanted to use it. Right now it just tiles it (yes, i know there is a switch to turn tiling off) acting like a ‘scratch off’ lottery ticket, as in, there is an image under neath (my bitmap) and my ‘drawing’ just makes it visible. Any help would be greatly appreciated… code is below:
var oldWay:Canvas = new Canvas() //Create bmp data: var bRect:BitmapData = new BitmapData(100, 100); //create bitmap var c:Canvas = new Canvas(); //create spoof canvas c.graphics.beginFill(oxFF0000);//start fill c.graphics.drawRoundRect(0,0, 100, 100,10,10);//draw that ****! c.graphics.endFill();//end fill bRect.draw(c);//draw this out to the bmpdata oldWay.graphics.lineStyle(bRect.height,0); //start a line style oldWay.graphics.lineBitmapStyle(bRect,null,true,false) //set bitmap style oldWay.graphics.moveTo(nX1, nY1);//move this to my old location oldWay.graphics.lineTo(nX2, nY2);//draw to new location
Image of results here: