Hi all,
i already create Drawing Application, the problem is i dont know how to do select each
shape i draw can delete the shape that i select.
here the code for drawing shape i create.
var temporaryDrawing:Shape = new Shape();
board.addChild(temporaryDrawing);
temporaryDrawing.graphics.lineStyle(2, 0x666666, 1);
var myDrawing:Shape = new Shape();
board.addChild(myDrawing);
myDrawing.graphics.lineStyle(lineSize, 0xFFFFFF, 1);
var mouseHolding:Boolean = false;
var clickedX:Number;
var clickedY:Number;
board.addEventListener(MouseEvent.MOUSE_DOWN, mDown);
board.addEventListener(MouseEvent.MOUSE_UP, mUp);
function mDown(MouseEvent):void
{
mouseHolding = true;
clickedX = mouseX;
clickedY = mouseY;
}
function mUp(MouseEvent):void
{
mouseHolding = false;
myDrawing.graphics.beginFill(currentColor, alphaColor);
myDrawing.graphics.drawRect(clickedX, clickedY, mouseX-clickedX, mouseY-clickedY);
myDrawing.graphics.endFill();
clearTemp();
}
board.addEventListener(MouseEvent.MOUSE_MOVE, mMove);
function mMove(MouseEvent):void
{
if (mouseHolding){
clearTemp();
temporaryDrawing.graphics.drawRect(clickedX, clickedY, mouseX-clickedX, mouseY-clickedY);
}
}
function clearTemp():void
{
temporaryDrawing.graphics.clear();
temporaryDrawing.graphics.lineStyle(2, 0x666666, 1);
}
can someone help me how to create function that when i draw many shape on the board. i can delete any shape
when i select those shape that i draw.
Can someone help ?