I found a code for above problem over the internet.
NOw, my second problem is the drawing line is at the back of the dotted alphabet. How can I make it appear in front of the dotted alphabet?
My third problem is I want to give user an alert to let them knowhey are out of border of the alphabet.
So, I create a box (movieclip, name:boundaryBox_mc) located around the alphabet. This box function as the boundary so when user is writing and it goes out, an alert pop - out or writing exercise is restart.
My question is how can I make the alert pop-out or the exercise restart when it happen?
The codes for the line drawing as below:
-
var drawingLine:MovieClip = new MovieClip();
-
addChildAt(drawingLine,0);
-
-
stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
-
stage.addEventListener(MouseEvent.MOUSE_UP, MouseUp);
-
-
function MouseDown(event:MouseEvent):void{
-
drawingLine.graphics.lineStyle(10);
-
drawingLine.graphics.moveTo(mouseX, mouseY);
-
stage.addEventListener(MouseEvent.MOUSE_MOVE, MouseMove);
-
}
-
-
function MouseMove(event:MouseEvent):void{
-
drawingLine.graphics.lineTo(mouseX, mouseY);}
-
-
function MouseUp(event:MouseEvent):void{
-
stage.removeEventListener(MouseEvent.MOUSE_MOVE, MouseMove);}
-