creating a swipe to trigger an animation over a specific object

I have been looking for the best way to insert a swipe into my program.

What I want is to have a horizontal swipe over a specific object. This swipe would then trigger a transition.to animation.

I was able to get a “tap” function to work but I can’t seem to get good results for a swipe.

I have been looking into the DMC libraries but I don’t grasp them yet.

Have you looked into the touch events? http://docs.coronalabs.com/api/event/touch/phase.html

In the “ended” phase of the touch event, you can compare the ending point (event.x, event.y) with the starting point (event.xStart, event.yStart). If the value is greater than a certain amount, then the transition.to animation is triggered.

That’s the way I would do it.

It works great. But there are a lot of concepts I dont grasp. getCurrentStage, setFocus. I will have to do research on them.

Thanks Again

Have you looked into the touch events? http://docs.coronalabs.com/api/event/touch/phase.html

In the “ended” phase of the touch event, you can compare the ending point (event.x, event.y) with the starting point (event.xStart, event.yStart). If the value is greater than a certain amount, then the transition.to animation is triggered.

That’s the way I would do it.

It works great. But there are a lot of concepts I dont grasp. getCurrentStage, setFocus. I will have to do research on them.

Thanks Again