Using raw touch data, we can define custom gestures to develop unique interactions used in our application. We do this by making calculations based upon data delivered through raw touch events.
In this example, we will create a diagonal swipe gesture that can have four separate values returned which let us know the direction of a diagonal swipe.
1. First, import the following classes into your project:
import flash.display.Shape; import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.TouchEvent; import flash.text.TextField; import flash.text.TextFormat; import flash.ui.Multitouch; import flash.ui.MultitouchInputMode;
2. Declare a
TextField
andTextFormat
object to allow visible text output upon the device:private var traceField:TextField; private var traceFormat:TextFormat;
3. We will set up two additional objects to help track our...