I am working with Sencha Animator and am having trouble with the touchstart events when viewing the finished product on the iPad. Specifically, the touchstart action in the 3rd scene (which I'd set to take us back to Scene #1) is skipping from Scene 1 and going directly to Scene 2. The sequence we're aiming for is:

Why would the touchStart on the button in Scene 3 lead to Scene 1 automatically moving on to Scene 2? Is it because I also have the same button as a clickStart as well?

I appreciate your help-

Thank you.

13 Nov 2012, 11:33 PM

miro.bojic

Hi ccarlson12 and welcome to the forums,

From what you explained, it seems that the problem is in the way how you set up your interaction. I'm guessing that the button in question in Scene 3 and Scene 1 is in the same location?

When you touch the screen, two events are generated, touchstart at the moment when your finger touches the screen and touchend at the moment when your finger is lifted from the screen. What seems to be happening here is:

Scene 3
Finger touches the screen -> touchstart
Scene 1 is initialised
Because everything is rebuilt, the events are reset
touchstart is recognized again, as the finger is still on the screen
Scene 2 is initialised

I would suggest to always use touchend on the buttons, so the interaction requires a tap, not just a touch. Touchstart is better used for defining interactions such as touch-and-hold, where on touchstart you would start a timer (think of holding an icon on iPhone until they start shaking and you can rearrange them). Also, on touchstart you can change the color of the button to indicate that is pressed as long as there's a finger on it, but on touchend you actually trigger the scene switching.

13 Nov 2012, 11:37 PM

miro.bojic

Ah another thing, touchstart and touchend are better suited for defining touch gestures, as on mobile devices, click event will still be generated. So another thing that is potentially happening here, if you have both click and touchstart initialised, and set to 'go to next scene', is simply that on every touch of the button, 'go to next scene' is called 2 times. To fix this, simply disable touchstart event - it will still work on ipad with just click event.