CLICK HERE TO COPY
Actionscript:
var canvas:Shape = Shape(addChild(new Shape()));
var gestures:Array=[];
var gestureNum:int = 0;
var capGesture:Array;
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
function onDown(evt:MouseEvent):void{
capGesture=[];
addEventListener(Event.ENTER_FRAME, onCapture);
canvas.graphics.lineStyle(3, 0xFF0000);
canvas.x = mouseX;
canvas.y = mouseY;
canvas.graphics.moveTo(0, 0);
}
function onUp(evt:MouseEvent):void{
gestures.push(capGesture.concat());
gestureNum++;
canvas.graphics.clear();
removeEventListener(Event.ENTER_FRAME, onCapture);
}
function onCapture(evt:Event):void{
capGesture.push(new Point(canvas.mouseX, canvas.mouseY));
canvas.graphics.lineTo(canvas.mouseX, canvas.mouseY);
}
var [...]