Type Function Object SpriteObject Library display.* Return value none Revision Current Public Release (2018.3326) Keywords play See also display.newSprite() object:setSequence() object:pause()
Play an animation sequence, starting at the current frame. This does not reset looping.
Sprite events are dispatched to the object's listener. These events tell what phase of the animation playback the sprite is in. These can have one of the following phases:
"began"the sprite began playing
"ended"the sprite finished playing
"bounce"the sprite bounces from forward to backward while playing
"loop"the sprite loops from the beginning of the sequence
"next"the sprite plays a subsequent frame that's none of the above phases
See event.phase for more information.
spriteObj:setSequence( "man" ) spriteObj:play() -- add the event listener to the sprite object local function spriteListener( event ) print( "Sprite event: " .. event.phase ) end -- Add sprite listener spriteObj:addEventListener( "sprite", spriteListener )