I am really a newbie at this so forgive me if this is something simple.
I have created a sprite sheet which I load in a storyboard format:
-- Called when the scene's view does not exist:
function scene:createScene( event )
local screenGroup = self.view
sheet1 = sprite.newSpriteSheet( "/assets/page01-sprite-chair.png", 350, 380 )
spriteSet1 = sprite.newSpriteSet(sheet1, 1, 12)
sprite.add( spriteSet1, "chair", 1, 12, 3000, 0 )
instance1 = sprite.newSprite( spriteSet1 )
instance1.x, instance1.y = display.contentWidth/2 - 200, display.contentHeight - 400
instance1:prepare("chair")
I would like to remove the sprite sheet to transition to another page. I have tried to put this:
-- Called when scene is about to move offscreen:
function scene:exitScene( event )
-- remove spritesheet
instance1:dispose()
But when I transition, the sprite sheet is still there and I get an error and the application crashes:
attempt to call method ‘dispose’ (a nil value)
How do I syntax this correctly? [import]uid: 152474 topic_id: 29158 reply_id: 329158[/import]
[import]uid: 52491 topic_id: 29158 reply_id: 117268[/import]