Created
April 2, 2011 12:01
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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