I am trying to write android application in flash CS6 and I'm using sprite.
When I ran the application I draw in the first screen.
When I move to the next screen the line that I've drawn in the first screen still remain in the next screen.
My code:
import flash.display.Sprite;
import flash.events.MouseEvent;
var ranWidth:Number;
var myLine:Sprite = new Sprite();
addChild(myLine);
function onMouseDown(event:MouseEvent):void
{
stage.addChild(myLine);
ranWidth = Math.round((Math.random() * 10)+2);
myLine.graphics.lineStyle(ranWidth, 0xff0000, 100);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
function onMouseMove(event:MouseEvent):void
{
myLine.graphics.lineTo(mouseX, mouseY);
}
function onMouseUp(event:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
Can anyone help me how to solve this problem?
How to remove the line that I've drawn in the first screen so that it wont remain when I move to the next screen.