-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
Hi, when i'm trying to draw a line by mouse, i code like this:
_s = new Shape();
_s.graphics.lineStyle(1, 0x00ff00);
addChild(_s);
stage.addEventListener(TouchEvent.TOUCH, onTouch);
private function onTouch(e:TouchEvent):void {
var touch:Touch = e.getTouch(stage);
if(touch) {
switch(touch.phase) {
case TouchPhase.BEGAN:
_s.graphics.moveTo(touch.globalX, touch.globalY);
break;
case TouchPhase.MOVED:
_s.graphics.lineTo(touch.globalX, touch.globalY);
break;
}
}
}
but i found _s.graphics.moveTo(touch.globalX, touch.globalY); doesn't work, when i press down mouse expect the first time. and the lines will link together.
is there anything wrong with my code?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels