Features  »  Supported Gestures  »  One Finger Drag Gesture

One Finger Drag

The ‘one finger drag’ event is an extension of a ‘mouse movement’ event. When you place a finger on the screen and drag it, the event fires.

Using the One Finger Drag Event

The ‘one finger drag’ event is typically used to move items across the screen surface.

Mechanics and Code Samples

To register a ‘one finger drag’, touch down and move a finger across the touch screen surface.

1
2
container.addEventListener(TouchEvent.TOUCH_DOWN, startDrag_Press);
container.addEventListener(TouchEvent.TOUCH_UP, stopDrag_Release);
1
2
3
4
5
6
private function startDrag_Press(e:TouchEvent):void {
    e.target.startTouchDrag();
}
private function stopDrag_Release(e:TouchEvent):void {
    e.target.stopTouchDrag();
}

Parameters

All touch and gesture events have a localX and localY (relative) position as well as a stageX and stageY (absolute) position.

In addition, the ‘one finger drag’ gesture must be used in conjunction with a touch listener for touch down and touch up before the startTouchDrag or stopTouchDrag method can be called.

Related Gestures

Multi-point Drag

Associated Tutorials

How To Create An Application Using Touch Drag