I am a newbie and the situation is from the menu of the game that i’ve created is a music button when you tap it, it will actually disable itself with another logo and hold itself until i enable it again. here is my code
local function onMusicBtnRelease()
local hold = display.newImage(“images/Buttons/Music1.png”)
return true
end
local musicBtn = widget.newButton{
defaultFile =“images/Buttons/Music.png”,
overFile =“images/Buttons/Music1.png”, <------- logo that has a disable sign
width= 900, height=300,
onRelease = onMusicBtnRelease – event listener function
The overFile isn’t a toggle. It’s simply a highlight while the button is being touched. You probably should not use widget.newButton() for this. You can either build your own button using techniques from:
or consider using widget.newSwitch() instead. In particular if you’re wanting to enable/disable music, an on/off switch is a more appropriate and it can be skinned with different graphics to represent on and off.
The overFile isn’t a toggle. It’s simply a highlight while the button is being touched. You probably should not use widget.newButton() for this. You can either build your own button using techniques from:
or consider using widget.newSwitch() instead. In particular if you’re wanting to enable/disable music, an on/off switch is a more appropriate and it can be skinned with different graphics to represent on and off.