Hi guys,
I am making an audio button, my question is how do you change the defaultFile image of the button when it has been clicked to reflect if there is or no sound.
What I want is that if a user clicks the button to mute or resume, the image of the button changes accordingly and stays like that until the user clicks again.
thanks for your help.
[lua]
local function onSoundButtonEvent(event)
local sound =event.target
if (sound.status ==“waiting”) then
audio.play(sounds[“intro”],{channel=1,loops=-1, fadein=500,})
sound.status = “playing”
elseif(sound.status ==“playing”) then
audio.pause(1)
sound.status = “paused”
elseif(sound.status==“paused”)then
audio.resume(1)
sound.status=“playing”
end
end
local soundBtn = widget.newButton{
labelColor = { default={255}, over={128} },
defaultFile=“img/hud/audio.png”,
overFile=“img/hud/audioOver.png”,
width=60, height=60,
onRelease= onSoundButtonEvent
}
soundBtn.status=“waiting”
[/lua]