Skip to content

Instantly share code, notes, and snippets.

@tracend
Created April 2, 2011 12:01
Show Gist options
  • Save tracend/899442 to your computer and use it in GitHub Desktop.
Save tracend/899442 to your computer and use it in GitHub Desktop.
AS3: Using the Swipe Gesture in Flash Using ActionScript 3.0 - Source: http://www.republicofcode.com/tutorials/flash/as3swipegesture/
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
square_mc.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
function onSwipe (e:TransformGestureEvent):void{
if (e.offsetX == 1) {
//User swiped towards right
square_mc.x += 100;
}
if (e.offsetX == -1) {
//User swiped towards left
square_mc.x -= 100;
}
if (e.offsetY == 1) {
//User swiped towards bottom
square_mc.y += 100;
}
if (e.offsetY == -1) {
//User swiped towards top
square_mc.y -= 100;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment