From 4046a7eab605e1b074e0675e53ad90019ef0d79e Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Tue, 3 May 2011 22:27:18 -0700 Subject: [PATCH] cleanup sketch class --- src/SketchShape.as | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SketchShape.as b/src/SketchShape.as index bfd7199..a70f2c5 100644 --- a/src/SketchShape.as +++ b/src/SketchShape.as @@ -33,10 +33,16 @@ package private function init(e: Event):void { removeEventListener(Event.ADDED_TO_STAGE, init); - stage.doubleClickEnabled = true; + addEventListener(Event.REMOVED_FROM_STAGE, cleanup); stage.addEventListener(MouseEvent.CLICK, onClick); stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove); } + private function cleanup(e: Event):void + { + removeEventListener(Event.REMOVED_FROM_STAGE, cleanup); + stage.removeEventListener(MouseEvent.CLICK, onClick); + stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove); + } public function clear():void { rgpoint = []; @@ -76,13 +82,13 @@ package } private function redrawShape():void { - ClickArea.drawShape(shape, rgpoint, 0x555555, 0x000000, 0.1); + ClickArea.drawShape(shape, rgpoint, 0x555555, 0xb8860b, 0.1); } private function redrawLine(ptEnd:Point):void { var ptStart:Point = rgpoint[rgpoint.length - 1]; shapeLine.graphics.clear(); - shapeLine.graphics.lineStyle(1); + shapeLine.graphics.lineStyle(1, 0xb8860b); shapeLine.graphics.moveTo(ptStart.x, ptStart.y); shapeLine.graphics.lineTo(ptEnd.x, ptEnd.y); }