removing old objects

I am currently working on transitions for a game and I have the transitions down, but I don’t know how to get rid of old objects from past levels to keep the memory down. Can someone help me one this? Thanks for any help! [import]uid: 94237 topic_id: 19028 reply_id: 319028[/import]

use the director module, its very easy to use and it get rid of all display objects for you on scene change [import]uid: 16142 topic_id: 19028 reply_id: 73376[/import]

I am currently using director [import]uid: 94237 topic_id: 19028 reply_id: 73378[/import]

if I am using director and it isn’t getting rid of the old objects is something going wrong or am I doing something wrong? [import]uid: 94237 topic_id: 19028 reply_id: 73402[/import]

It sounds as though you aren’t adding the objects to the local group.

See here; http://techority.com/2010/11/19/how-to-use-scenesscreens-in-corona/

Peach :slight_smile: [import]uid: 52491 topic_id: 19028 reply_id: 73421[/import]

I have everything inserted if that is what you mean. I will post some code and maybe that will help. Another problem we are having is that when the level transitions the music continues but it skips about one second. this is the code for the first level

[code] module(…, package.seeall)

–_G.playWorld1Soundtrack()

if world1Soundtrack then
timer.cancel(_G.bbbbbb)
_G.bbbbbb = nil
_G.bbbbbb = timer.performWithDelay(1, _G. playWorld1Soundtrack, 0)
else
_G.bbbbbb = timer.performWithDelay(1, _G. playWorld1Soundtrack, 0)
end

–local world1Soundtrack = audio.loadStream(“AClimber_World_1.mp3”)
–local world1SoundtrackOn = false

–function music()
–if (world1SoundtrackOn == false) then
–world1SoundtrackOn = true
– audio.play(world1Soundtrack)
–elseif (world1SoundtrackOn == true) then
– end
–end
–music()
function new()
local localGroup = display.newGroup()

local background = display.newImage(‘1-0.png’, true)
–background.x = 320
–background.y = 480
–background:scale(display.contentWidth/320, display.contentHeight/480)
background:scale(display.contentWidth/640, display.contentHeight/960)
background:setReferencePoint(display.TopLeftReferencePoint)
–background.x = 640
–background.y = 960
background:toBack()

local endButton = display.newImage(‘endbutton.png’,true)
endButton:setReferencePoint(display.CenterReferencePoint)
endButton.x = 50
endButton.y = 100
endButton.scene = “oneone”
–continueButton.name = ‘continueB’
–local optionsB = display.newImage(‘optionButton.png’, true)
–optionsButton.x = 230
–optionsButton.y = 500
–optionsButton.name = ‘optionsB’

function changeScene(e)
if(e.phase == “ended”) then
–audio.stop(world1Soundtrack)
_G.stopWorld1Soundtrack()
director:changeScene(e.target.scene);
end
end

localGroup:insert(background)
localGroup:insert(endButton)
–localGroup:insert(continueButton)
–localGroup:insert(optionsB)

–localGroup:insert(startButton)
–localGroup:insert(continueButton)
–localGroup:insert(optionsButtion)

endButton:addEventListener(‘touch’, changeScene)

–continueButton:addEventListener(‘touch’, changeScene)
–optionsButton:addEventListener(‘touch’, changeScene)

return localGroup
end [import]uid: 94237 topic_id: 19028 reply_id: 73566[/import]