storyboard memory management.

Hello,
I cannot seem to remove sprites from my scenes when I place the remove in exit scene. I have a forward declaration in my file.
It gives me a nil value when I try to remove it. [import]uid: 100901 topic_id: 24529 reply_id: 324529[/import]

Could you post a code sample? [import]uid: 118390 topic_id: 24529 reply_id: 99320[/import]

This is my sprite code in the enter scene part:

 local sprite = require("sprite")  
 local test = require("jjOgen-hd")  
 local spriteData = test.getSpriteSheetData()  
 local sheet1 = sprite.newSpriteSheetFromData( "jjOgen@2x.png", spriteData )  
 local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 11)  
 local instance1 = sprite.newSprite( spriteSet1 )  
 sprite.add( spriteSet1, "ogenJJ", 1, 11, 3000,0)  
 instance1:prepare("ogenJJ")  
 instance1:play()  
 group:insert(instance1)  

in exit scene i use

sheet1:dispose()  

I added a forward declaration but with it it gave me a nil value error.
I made the sheet1 global by removing the local, which stopped it giving an error. So I thought it worked.
But after using Cider I checked the memory and the table created by sheet1 jjOgen-hd was still in memory.

in the sample code they don’t use spritesheetfromdata

local sprite = require("sprite") local spriteSheet = sprite.newSpriteSheet("test.png") -- Later dispose of the sprite sheet and all of its associated sprites, sequences and sets. spriteSheet:dispose()
[import]uid: 100901 topic_id: 24529 reply_id: 99330[/import]

I think I found the problem.
The external file doesn’t get removed by disposing the sprite.
It might work if I place the code from the external file inside the regular code, but that would be too messy.
[import]uid: 100901 topic_id: 24529 reply_id: 99371[/import]

Maybe try setting sheet1 = nil after disposing it. Also make sure you don’t have event listeners attached to it (or the display objects using it), this will also keep it in memory.

[import]uid: 118390 topic_id: 24529 reply_id: 99493[/import]

Yeah I am setting everything to nil. Not sheet1 though. Judt the external datafile.
Sheet1 gets removed by storyboard. Storyboard just doesn’t do anything with the externally loaded spritetables.
So I have to set them to nil by hand.
Hopefully imagesheets work better. [import]uid: 100901 topic_id: 24529 reply_id: 99496[/import]