flash.events

# GesturePhase - AS3

Package | flash.events
Class | public final class GesturePhase
Inheritance | GesturePhase Object

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.1, AIR 2, Flash Lite 4

The GesturePhase class is an enumeration class of constant values for use with the GestureEvent, PressAndTapGestureEvent, and TransformGestureEvent classes. Use these values to track the beginning, progress, and end of a touch gesture (such as moving several fingers across a touch enabled screen) so your application can respond to individual stages of user contact. Some gestures (swipe and two-finger tap gestures) do not have multiple phases, and set the event object `phase` property to `all`.

View the examples

Related API Elements

flash.events.GestureEvent
flash.events.TransformGestureEvent
flash.events.PressAndTapGestureEvent

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Public Constants

| Constant | Defined By
--- | --- | ---
|  | ALL : String = "all" [static] A single value that encompasses all phases of simple gestures like two-finger-tap or swipe. | GesturePhase
|  | BEGIN : String = "begin" [static] The beginning of a new gesture (such as touching a finger to a touch enabled screen). | GesturePhase
|  | END : String = "end" [static] The completion of a gesture (such as lifting a finger off a touch enabled screen). | GesturePhase
|  | UPDATE : String = "update" [static] The progress of a gesture (such as moving a finger across a touch enabled screen). | GesturePhase

Constant Detail

### ALL

Constant

`public static const ALL:String = "all"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.1, AIR 2

A single value that encompasses all phases of simple gestures like two-finger-tap or swipe. For gestures that set the event object `phase` property to `all` (swipe and two-finger tap gestures), the `phase` value is always `all` once the event is dispatched.

Related API Elements

flash.events.GestureEvent
flash.events.TransformGestureEvent
flash.events.PressAndTapGestureEvent

### BEGIN

Constant

`public static const BEGIN:String = "begin"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.1, AIR 2, Flash Lite 4

The beginning of a new gesture (such as touching a finger to a touch enabled screen).

Related API Elements

flash.events.GestureEvent
flash.events.TransformGestureEvent
flash.events.PressAndTapGestureEvent

### END

Constant

`public static const END:String = "end"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.1, AIR 2, Flash Lite 4

The completion of a gesture (such as lifting a finger off a touch enabled screen).

Related API Elements

flash.events.GestureEvent
flash.events.TransformGestureEvent
flash.events.PressAndTapGestureEvent

### UPDATE

Constant

`public static const UPDATE:String = "update"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.1, AIR 2, Flash Lite 4

The progress of a gesture (such as moving a finger across a touch enabled screen).

Related API Elements

flash.events.GestureEvent
flash.events.TransformGestureEvent
flash.events.PressAndTapGestureEvent
Examples How to use this example
TransformGestureEventExample.as
The following example shows event handling for the `GESTURE_ROTATE` events. While the user performs a rotation gesture on the touch-enabled device, mySprite rotates and myTextField populates with the current phase.
Copy

    Multitouch.inputMode = MultitouchInputMode.GESTURE;

    var mySprite = new Sprite();
    mySprite.addEventListener(TransformGestureEvent.GESTURE_ROTATE , onRotate );
    mySprite.graphics.beginFill(0x336699);
    mySprite.graphics.drawRect(0, 0, 100, 80);
    var myTextField = new TextField();
    myTextField.y = 200;
    addChild(mySprite);
    addChild(myTextField);

    function onRotate(evt:TransformGestureEvent):void {

        evt.target.rotation -= 45;

        if (evt.phase==GesturePhase.BEGIN) {
            myTextField.text = "Begin";
        }
        if (evt.phase==GesturePhase.UPDATE) {
            myTextField.text = "Update";
        }
        if (evt.phase==GesturePhase.END) {
            myTextField.text = "End";
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00