Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Developer
mdd
Posts: 225
Registered: ‎01-17-2012
My Device: PB

Re: Swipe gesture fires multiple times

I suggest reading the docs on TransformGestureEvent:

 

In particular, look at the phase attribute, which indicates if it is a BEGIN, UPDATE or END.

 

Regards,

Please use plain text.
Contributor
varliali
Posts: 14
Registered: ‎03-11-2013
My Device: Dev Alpha B

Re: Swipe gesture fires multiple times

Thanks mdd, your suggestion worked. But it is interesting because it clearly states that "For swipe events, this value is always all corresponding to the value GesturePhase.ALL once the event is dispatched." in the docs.

 

Anyway, here is my swipe event listener function:

public function onSwipe (e:TransformGestureEvent):void {
	if (e.phase==GesturePhase.BEGIN) { //THIS IF CONDITION WAS ADDED
		if (e.offsetX == 1) { //right
			wMove(1,0);
		}
		if (e.offsetX == -1) { //left
			wMove(-1,0);
		} 
		if (e.offsetY == 1) { //down
			wMove(0,1);
		}
		if (e.offsetY == -1) { //up
			wMove(0,-1);
		}
	}
}

 

Please use plain text.