# Application Drawing (delete shape problem)

**URL:** <https://forum.kirupa.com/t/application-drawing-delete-shape-problem/326669>\
**Category:** flash\
**Created:** [January 4, 2012, 2:09am UTC](https://forum.kirupa.com/t/application-drawing-delete-shape-problem/326669 "2012-01-04T02:09:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lantui](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Lantui](https://forum.kirupa.com/u/Lantui)\
**Post date:** [January 4, 2012, 2:09am UTC](https://forum.kirupa.com/t/application-drawing-delete-shape-problem/326669/1 "2012-01-04T02:09:11Z")

</div>

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.

```auto

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 ?
