Destroying group

I have added a cartoon balloon with words into my menu.lua, but when the scene is changed the bubble is still open. How would I properly distroy this balloon within director class?

[code]
– Modules –
local balloons = require(“Balloons”)

– A diary –
local Thoughts = {}

– Fire the event when? –
local Delay = 0

local dw = display.contentWidth
local dh = display.contentHeight

for _, thought in ipairs{
{ x = 60, y = dh - 190, text = “Quiz a friend!”, name = “first” }

} do
if type(thought) == “string” then
timer.performWithDelay(Delay, function()
Thoughts[thought]:removeSelf()

Thoughts[thought] = nil
end)

Delay = Delay + 50
else
timer.performWithDelay(Delay, function()
local balloon = balloons.Thought(display.getCurrentStage(), thought.x, thought.y, thought.text, math.random(3, 5))

if thought.name then
Thoughts[thought.name] = balloon
end
end)

Delay = Delay + 2500
end

[/code] [import]uid: 88495 topic_id: 34467 reply_id: 334467[/import]

Typically with Director, you add any created display objects into a group called localGroup. Anything in that group is automatically destroyed when changing scenes. I don’t know what your balloon object is returning but if it’s a display object or a group, just do a

localGroup:insert(balloon)

and that should take care of it, assuming balloon is a display object of some sort.
[import]uid: 199310 topic_id: 34467 reply_id: 137062[/import]

And a local object would be anything with text or not necessarily? [import]uid: 88495 topic_id: 34467 reply_id: 137077[/import]

displayGroups can only :insert display objects. So anything from display.*, such as newText, newRect, newImage, etc. can all go in.

[import]uid: 41884 topic_id: 34467 reply_id: 137118[/import]

Typically with Director, you add any created display objects into a group called localGroup. Anything in that group is automatically destroyed when changing scenes. I don’t know what your balloon object is returning but if it’s a display object or a group, just do a

localGroup:insert(balloon)

and that should take care of it, assuming balloon is a display object of some sort.
[import]uid: 199310 topic_id: 34467 reply_id: 137062[/import]

And a local object would be anything with text or not necessarily? [import]uid: 88495 topic_id: 34467 reply_id: 137077[/import]

displayGroups can only :insert display objects. So anything from display.*, such as newText, newRect, newImage, etc. can all go in.

[import]uid: 41884 topic_id: 34467 reply_id: 137118[/import]