The amazing adventures of Doug Hughes

Adobe just released the beta version of Flash Player 10.1 on their ‘labs’ site. Previously I’ve written about the new multi-touch events and written a quick how to on displaying multi-touch events with the new Air 2 SDK and now I’m going to talk quickly about checking a users multi-touch capabilities.

Checking the users multi-touch capabilities is especially important because users hardware and multi-touch capabilities is going to vary widely as new monitors, mice and input devices trickle into the market place. As such, we’ll need to adjust our application to take advantage of different ‘MultiTouchInputModes’.

Here’s the code I’m suggesting:

protected function application1_creationCompleteHandler(event:FlexEvent):void {

protected function addTransformListeners():void {
			transformEventHandler, false, 0, true);
			transformEventHandler, false, 0, true);
			transformEventHandler, false, 0, true);
			transformEventHandler, false, 0, true);

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

protected function touchEventHandler(event:TouchEvent):void {

protected function transformEventHandler(event:TransformGestureEvent):void {

protected function setTouchScreenType():void {

	if (Capabilities.touchscreenType == TouchscreenType.FINGER) {
		Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
	else {
		Multitouch.inputMode = MultitouchInputMode.GESTURE;

Before assuming that they have gesture capabilities we could also check if they are on Snow Leopard:

if(Capabilities.os.indexOf('Mac OS 10.6') !=-1 )
	trace('Your kicking it with Snow Leopard');

I’m not sure how to check if they are on a laptop with a trackpad. Any ideas?

Any danger in just listening for all of these events? Well nothing life threatening. If the hardware isn’t capable, the events simply don’t fire. It’s always a good idea to use weak references when listening for events and/or remove event listeners so that we’re not inadvertently using up unneeded memory allocations.

So with this information we can somewhat accurately customize our application to take advantage of what type of hardware our users might be sitting behind. We might have a picture collage that reacts differently to the different type of hardware that it’s viewed on for example.

If your company is interested in multi-touch or just want to talk. Drop us a note on our contact page.

Comments on: "Checking the Users Multi-Touch Capabilities" (1)

  1. Can’t believe I forgot these two valuable tidbits:

    Multitouch.supportedGestures; Multitouch.supportsGestureEvents;


Comments are closed.

Tag Cloud

%d bloggers like this: