Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > FlashLite / Portable Devices Development

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 12-20-2011, 03:53 AM   #1
irrelevantjoker
Registered User
 
Join Date: Oct 2008
Posts: 13
Default [iOS] Swipe Gesture not working with 2 or more fingers.

This function only seems to work on iOS and Android devices if you swipe 1 finger. Anything more than 1 and nothing happens. Any ideas?

ActionScript Code:
Multitouch.inputMode = MultitouchInputMode.GESTURE; this.addEventListener (TransformGestureEvent.GESTURE_SWIPE, SwipeHandler, false, 0, true); protected function SwipeHandler(event:TransformGestureEvent):void         {                 _sliding = true;                 switch(event.offsetX)                 {                     case 1:                         slideLeft();                     break;                                 case -1:                         slideRight();                     break;                 }         }
irrelevantjoker is offline  
Old 12-20-2011, 03:33 PM   #2
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

What do you get when running the supportedGestures() method?
__________________
aswebcreations
Super Duper!
ASWC is offline  
Old 12-20-2011, 10:56 PM   #3
irrelevantjoker
Registered User
 
Join Date: Oct 2008
Posts: 13
Default

gestureZoom
gesturePan
gestureRotate
gestureTwoFingerTap
gestureSwipe

The swipe gesture is called when one finger is swiped. If I use 2 or more fingers, it isn't called.

I'm looking for a way so that any number of fingers swiped at the same time will call the function.
irrelevantjoker is offline  
Old 12-21-2011, 02:11 AM   #4
irrelevantjoker
Registered User
 
Join Date: Oct 2008
Posts: 13
Default

After some research I've moved away from the swipe gesture event, and I've gone with the following, it's a little longer, but allows for more customisation.

I've pulled this code out of my app-in-progress, it allows any-finger swiping, but can be edited to isolate 1 to 5 finger swiping.

ActionScript Code:
import flash.ui.Multitouch; import flash.ui.MultitouchInputMode; import flash.events.TransformGestureEvent; import flash.events.TouchEvent; private var touchMoveID:int = 0; private var swipeX:Number; private var swiped:Boolean = false; if (Multitouch.supportsGestureEvents) {     Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;     mc.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin, false, 0, true);                 }         private function onTouchBegin(event:TouchEvent):void {     if (touchMoveID != 0) return;     touchMoveID = event.touchPointID;     mc.addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove,false,0,true);     mc.addEventListener(TouchEvent.TOUCH_END, onTouchEnd,false,0,true);     swipeX = event.stageX; }         private function onTouchMove(event:TouchEvent):void {     if (event.touchPointID != touchMoveID || swiped) return;     var gapX:Number = swipeX - event.stageX;     if (gapX > 100) {         swiped = true;         trace("SWIPED RIGHT");        }else if (gapX < -100) {         swiped = true;         trace("SWIPED LEFT");     } }         private function onTouchEnd(event:TouchEvent):void {     if (event.touchPointID != touchMoveID) return;     touchMoveID = 0;     swiped = false; }
irrelevantjoker is offline  
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:45 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.