I don’t think you have to remove every object in current scene before loading new scene.
in director 1.2 I can see a cleanGroups() which will loop through all the display objects in group and will remove them.
see the code used for that
[lua]local function cleanGroups ( curGroup, level )
if curGroup.numChildren then
while curGroup.numChildren > 0 do
cleanGroups ( curGroup[curGroup.numChildren], level+1 )
end
if level > 0 then
curGroup:removeSelf()
end
else
curGroup:removeSelf()
curGroup = nil
return true
end
end[/lua]
In director 1.3 the release note says that
Function cleanGroups() removed
There is no need to keep this function because Ansca changed the removeSelf() method to be recursive, so now the scene groups are cleaned only with the removeSelf().
But in order for director class to remove the display objects in current scene you should make sure that all objects in the current scene are added to a local display group which is passed as part of director class.
NOTE: What I notice is, if you are loading a new scene from your main.lua file you have to manually remove all the display objects as main.lua is not loaded from a local group returned as part or Director class.
*edit
To know whether your display objects are properly removed the simplest way is to try renaming it when the new scene is loaded. If its still being used it will throw an error message. [import]uid: 71210 topic_id: 13423 reply_id: 49361[/import]