With the code underneath I manage to detect swiping from left to right and right to left.
However, what I want is to detect a wiping gesture.
So, the movement is left to right to left to right without releasing your finger to the screen (almost like clearing the screen with a rubbing movement or a better example: the swype function on the keyboard of samsung device).
The problem is that I need to release my finger to detect swiping to left or to right.
I already used a counter for swiping. If you swipe 5 times, something is activated.
How can I solve this?
Code:
Multitouch.inputMode = MultitouchInputMode.GESTURE;
var swipeCounter:Number = 0;
stage.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function onSwipe(e:TransformGestureEvent):void
{
if (e.offsetX == 1)
{
trace("User swiped towards right");
swipeCounter++;
}
if (e.offsetX == -1)
{
trace("User swiped towards left");
swipeCounter++;
}
}
function enterFrameHandler(event:Event):void {
count.text = swipeCounter.toString();
if (swipeCounter == 5) {
swipeStatus.text = "geswiped";
trace("Swiped");
swipeCounter = 0;
}
}