Actually, i am a little bit confused on how to used onoffswitch.
onOffSwitch = widget.newSwitch
{
left = 80,
top = -40,
initialSwitchState = true,
onPress = onOffSwitchListener,
onRelease = onOffSwitchListener,
}
If anyone can help me, how to work on it if I want to play sound during on switch and off if switch that widget.
local function onOffSwitchEvent( event )
– Update the status box text
–statusText.text = "On/Off Switch\nIs on?: " … tostring( event.target.isOn )
local onOffSwitch = event.target
if (onOffSwitch.isOn) then
audio.resume( popSound )
else
audio.pause( popSound )
end
end
It is the correct way or there is another way to work on it?