Sometimes the predefined gestures that are baked into Flash Player and AIR are not enough for certain application interactions. This recipe will demonstrate how to access raw touch data reported by the operating system through Flash Player or AIR APIs.
To read raw touch data in your project, perform the following steps:
1. First, import the following classes into your project:
import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.display.Stage; import flash.display.Sprite; 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 output upon the device:private var traceField:TextField; private var traceFormat:TextFormat;
3. We will now set up our
TextField
, apply aTextFormat
, and add it to theDisplayList
. Here, we create a method to perform all of these actions...