Hello,
I want to ask a simple question.
Must I remove all Timer and Transition objects once created?
I have a destructor like this:
local function onDestroy() -- remove listeners Obj:removeEventListener("tap", onTap) --// I can skip this line if Obj is removed elsewhere, right? Runtime:removeEventListener( "enterFrame", mainLoop ) -- remove global variables var = nil -- dispose sound for i = 1, #soundGroup do audio.dispose(soundGroup[i]) soundGroup[i] = nil end -- remove transitions for i=1, #transGroup do if(transGroup[i]) then transition.cancel(transGroup[i]) transGroup[i] = nil end end --remove timers for i=1, #timerGroup do if(timerGroup[i]) then timer.cancel(timerGroup[i]) timerGroup[i] = nil end end -- remove display objects for i = 1, #displayGroup do displayGroup[i]:removeSelf() displayGroup[i] = nil end -- call destructors of required modules required1.onDestroy() package.loaded["required1"] = nil end
1.Is this destructor defined properly?
2.And what if there are a lot of transition and timer objects?
For example, I need to perform with delay quite often, will this occupy a lot of memory till I remove them?
3.Can I use the same timer object to do this repetitive delay?
I wonder will this cause conflict.
Thanks for reading.