Papa De Beau
Papa De Beau

Reputation: 3828

as3 air app for phone - slight delay tween after button press

I have noticed a slight delay on my animations when I press a button. The audio will respond asap etc.. but the animation has a second or two delay. I notice it more on the iPhone.

It also happens if I want to show an MovieClip for the first time.

if I do /// Press code addChild(myMC); there is a delay on this too.

I notice its usually a mouse click event. intro.about.addEventListener(MouseEvent.CLICK, example);/// and example.

Could this be a coding issue? Is there a way to ensure faster animation with tighter code?

Upvotes: 0

Views: 343

Answers (1)

BadFeelingAboutThis
BadFeelingAboutThis

Reputation: 14406

Generally speaking (and this may not be your issue, but likely is), when using a touch device, the container (iOS in this case) will wait a short period before dispatching the click/mouseup event. It/They do this because they need to decide if you're doing a gesture/swipe.

You can get around this by either using the MOUSE_DOWN event instead of CLICK, or even better, use the TOUCH events - as shown below:

in your document class (or anywhere really), you need to initialize the touch-mode.

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT

Then the equivalent of mouse down, is touch begin:

TouchEvent.TOUCH_BEGIN

And the equivalent of mouse up is touch end:

TouchEvent.TOUCH_END

They are found in these packages:

import flash.events.TouchEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;

Even if your issue ends up being something else, please don't donwvote as it may be useful to others searching with a similar problem

Upvotes: 1

Related Questions