how to remove a sprite sheet after it is completed

hey, I have a sprite sheet called every time a collision happens,

and It’s in the function within the .createScene function, it’s like this:

[lua]rainbowEx =
{
– Required params
width = 320,
height = 320,
numFrames = 18,
– content scaling
sheetContentWidth =5760,
sheetContentHeight = 320,

}

function repRainbowExplosion()
rainbowExplosionSheet = graphics.newImageSheet( “Explosion_SpritesheetR22.png”, rainbowEx )
rainbow_exp = display.newSprite( rainbowExplosionSheet, { name=“rainbow_b_exp”, start=1, count=18, time=800, loopCount = 1 } )
rainbow_exp.anchorX = 0.5
rainbow_exp.anchorY = 0.5
rainbow_exp.x = display.contentCenterX
rainbow_exp.y = display.contentCenterY
–rainbow_exp:play()
rainbow_exp.isVisible = false

end[/lua]

I want explosion to be removed after it gets to the last frame, how is that possible ?

You can add event listeners to sprites – see this page of the docs:

http://docs.coronalabs.com/api/event/sprite/phase.html

The example code at the bottom of the page should get you going. Basically, you’ll look for an “ended” phase on the explosion and when that happens you’ll be able to remove it.

 Jay

thanks jay

You can add event listeners to sprites – see this page of the docs:

http://docs.coronalabs.com/api/event/sprite/phase.html

The example code at the bottom of the page should get you going. Basically, you’ll look for an “ended” phase on the explosion and when that happens you’ll be able to remove it.

 Jay

thanks jay