i have the following code:
newBG.addEventListener(MouseEvent.MOUSE_MOVE, nm2);
function nm2(e:Event):void
{
var sourceData:BitmapData = new BitmapData(500,400);
sourceData.draw(bg);
var sourceB:BitmapData = new BitmapData(100,100);
var sourceRect:Rectangle = new Rectangle(newBG.mouseX, newBG.mouseY,100,100);
var destP:Point = new Point(newBG.mouseX, newBG.mouseY);
sourceB.copyPixels(sourceData, sourceRect,destP);
trace("sourceRect: " + sourceRect + " destP: " + destP);
var newB:Bitmap = new Bitmap(sourceB);
newBG.addChild(newB);
newB.x = newBG.mouseX;
newB.y = newBG.mouseY;
}
newBG.addEventListener(MouseEvent.MOUSE_UP, nu2);
function nu2(e:Event):void
{
newBG.removeEventListener(MouseEvent.MOUSE_MOVE, nm2);
trace(newBG.numChildren);
}
this code is supposed to allow me to “erase” lines i have drawn on an empty movieclip above a movieclip with an image in it.
basically i let the user draw on the image, and i want them to be able to erase stuff, so i am trying to get it to use copyPixels to get the pixels of the image below and basically stamp it over the lines that were drawn. but when i run this code, the pasted data is white, unless i move the mouse to the top left corner, then it shows a square of the image from below, but anywhere else it just shows a white box.
Can anyone see anything obvious in my code?
Thanks in advance,
Dave