Someone please help me here!

Is there any way to remove a ui.Button after it has been pressed? Cant seem to find one anywhere.

My function is as follows:

local function fireObject ( event )
if (event.phase == “release”) then
audio.play( cannonFiredSound )
physics.addBody(object,“dynamic”, objectBody)
object:setLinearVelocity(cannon.rotation, -500)
end
end

local shootBtn = ui.newButton{
default = “cannonObjects/shoot.png”,
over = “cannonObjects/shootOver.png”,
onEvent = fireObject,
id = “shoot”
} [import]uid: 42126 topic_id: 8651 reply_id: 308651[/import]

locals have to be defined before they can be used. Since both the function and the button refer to each other in a circular way, you will have to use a forward declaration:

[code]
local shootBtn

local function fireObject etc

local shootBtn = ui.newButton etc
[/code] [import]uid: 12108 topic_id: 8651 reply_id: 31082[/import]

How would you then make the button a one-touch thing, where it wont work twice? [import]uid: 42126 topic_id: 8651 reply_id: 31097[/import]

Remove it in the fireObject() function. [import]uid: 12108 topic_id: 8651 reply_id: 31100[/import]

That doesnt work. But I figured out a way to do it. Thanks [import]uid: 42126 topic_id: 8651 reply_id: 31101[/import]