I was looking at the “Multitouch” sample, and I see that it creates objects and stores them into a table location. In the example, it shows how to remove the objects as they leave the screen area.
What I was wondering is if I change scenes using a storyboard API, what would be the best way to remove all objects on the screen and off the screen? Just remove all objects created with the spawnDisk function global?
Do I need to create a For Loop and remove all objects in the table individually or is there a simpler way to dump the whole table, and all objects within the table?
Below is the sample code from Multitouch for reference.
[code]
local function spawnDisk( event )
local phase = event.phase
if “ended” == phase then
audio.play( popSound )
myLabel.isVisible = false
randImage = diskGfx[math.random( 1, 3 )]
allDisks[#allDisks + 1] = display.newImage( randImage )
local disk = allDisks[#allDisks]
disk.x = event.x; disk.y = event.y
disk.rotation = math.random( 1, 360 )
disk.xScale = 0.8; disk.yScale = 0.8
transition.to(disk, { time = 500, xScale = 1.0, yScale = 1.0, transition = easingx.easeOutElastic }) – “pop” animation
physics.addBody( disk, { density=0.3, friction=0.6, radius=66.0 } )
disk.linearDamping = 0.4
disk.angularDamping = 0.6
disk:addEventListener( “touch”, dragBody ) – make object draggable
end
return true
end
[/code] [import]uid: 152474 topic_id: 29211 reply_id: 329211[/import]