How can I play an animation once then remove it from screen?

I have tried all sorts to have an animation play using sprite sheets then when the animation has finished playing remove it from screen.

Currently it plays perfectly but then the last frame is left on screen and I can find no way to remove it.

the code I use to run the anim is this, so how do i get it to disapear when its finished playing.

Thanks

Mike R

[code]local function splotIt()
if gameActive == true then
local splot = sprite.newSprite(spriteSet3)
splot.x = splotX
splot.y = splotY
splot:prepare(“splash”)
splot:play()
localGroup:insert(splot)
end
end[code] [import]uid: 9950 topic_id: 6029 reply_id: 306029[/import]

http://developer.anscamobile.com/reference/sprite-sheets#si:addEventListenersprite_listener [import]uid: 12108 topic_id: 6029 reply_id: 20672[/import]

Yes. I saw that but it makes no sense.

I have tried, splot:addEventListener(“end”,stopAnim) or splot:addEventListener(“splot”,stopAnim) or splot:addEventListener(“splash”,stopAnim)

and in the remove bit I have tried

local function stopAnim(event)
if event.phase == “end” then
splot:removeSelf()
splot = nil
end
end

and nothing works. No errors but no removing of the animations last frame from screen.

The event listener never fires at all and the help on that page is not very helpful to me at all. I use event listeners for all sorts but this is defeating me.

Cheers

Mike R [import]uid: 9950 topic_id: 6029 reply_id: 20679[/import]

Found another person who you replied to and he showed his resultant code and finally I get it. Doh. you use the word “sprite” then it works. hmmmm.

Cheers

Mike R [import]uid: 9950 topic_id: 6029 reply_id: 20692[/import]