Example of using animation events

This may be a simple question, but I am a newbie and I haven't been able to find an answer.

I would like my sprite animation to play and then when it is finished trigger a function to do some text manipulation.

Something like (pseudo-code):

tap on animation --
animation plays --
When animation is finished --
set text items on screen --

Thanks in advance for your suggestions.

Check this page. especially the last part

http://developer.anscamobile.com/reference/sprite-sheets

si:addEventListener("sprite", listener)

Notify listener when the spriteInstance animation has an event.

The event, passed to the listener, has the following fields:

event.sprite The sprite that fired the event; its current properties may also be accessed via the event: e.g., event.sprite.sequence.

event.phase
The phase is one of:

"end" - the sprite stops playing

"loop" - the sprite loops (from last to first, or reverses direction)

"next" - the sprite's next frame is played

views:1346 update:2011/10/1 9:04:19
corona forums © 2003-2011