The amazing adventures of Doug Hughes

Tracing Out MultiTouch Events

There hasn’t been a ton of interest when I’ve posted multi-touch subject matter on this blog in the past. But I’m not letting that stop me. I’m excited about the new features in the Beta version of Adobe Air 2, and I’m going to start in on a series of Blog posts that talk about some of the basics of the new multi-touch capabilities in the new flash player release.

One of the first things I did when I was starting to play with the new feature were to trace out all of the new multi-touch events that come with new Flash Player 10.1 (also used within Air 2 applications).

Here’s the code I quickly came up with:

protected function application1_creationCompleteHandler(event:FlexEvent):void {

protected function addTransformListeners():void {

protected function addTouchListeners():void {
	this.addEventListener(TouchEvent.TOUCH_BEGIN, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_END, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_MOVE, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_OUT, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_OVER, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_ROLL_OUT, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_ROLL_OVER, touchEventHandler);
	this.addEventListener(TouchEvent.TOUCH_TAP, touchEventHandler);

protected function touchEventHandler(event:TouchEvent):void {
	eventLabel.text = event.toString() + "n" + eventLabel.text;

protected function transformEventHandler(event:TransformGestureEvent):void {
	eventLabel.text = event.toString() + "n" + eventLabel.text;

protected function setTouchScreenType():void {
	if (Capabilities.touchscreenType != 'finger') {
		Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
	else {
		Multitouch.inputMode = MultitouchInputMode.GESTURE;

On the creation complete event I start listening for some of our new multi-touch events. Within the MXML I have a TextArea named ‘eventLabel’ that displays the events as a user touches the screen. Just that simple.

If you have a touch enabled screen or an OSX 10.6 operating system with a newish trackpad, feel free to give something like this a try and hopefully you’ll start to see all the new events scrolling down your screen.

In the next post in this series I plan on discussing the two new events of Flash Player 10.1 in a little more detail.

Thanks for any comments and corrections.

Comments on: "Tracing Out MultiTouch Events" (3)

  1. How does the TransformGestureEvent.GESTURE_ROTATE look like on a TrackPad? Like the same Apple handles it?


  2. @Ali

    If a user has OS 10.6 and flash player 10.1 the user could perform a gesture rotate event. The actual event looks pretty similar to a mouse event.

    The actual event would look like:

    [TransformGestureEvent type=”gestureRotate” bubbles=true, cancelable=false phase=null localX=20 localY=20 stageX=20 stageY=20 scaleX=1 scaleY=1 rotation=0 offsetX=0 offsetY=0 ctrlKey=false altkey=false shiftKey=false commandKey=false controlKey=false]

    Just like a mouse event the developer can handle that rotation event however they wanted. Most likely a developer might want to rotate the currentTarget of the TransformGestureEvent.


  3. You may nnot be getting a lot of interest now, but just wait ’til touchscreens are more mainstream. We were tapped to do a multitouch app for a kiosk style touch panel, and short of a vendor-provided c# technical sample and two or three vendors that have integrated the low-level bus messages up to a flash presentation layer, there just isn’t much out there right now.


Comments are closed.

Tag Cloud

%d bloggers like this: