how do you test to see if a widget switch is on or off???
here is what i have
[lua]
local function onsfxSwitchRelease()
–want to test if the switch is on or off and save the result to my icebox here
return true
end
function scene:createScene( event )
local group = self.view
-----------------------------------------------------------------------------
– CREATE display objects and add them to ‘group’ here.
– Example use-case: Restore ‘group’ from previously saved state.
– Use following format: group:insert( Name )
-----------------------------------------------------------------------------
– display a background image
local background = display.newImageRect( “background3.png”, display.contentWidth, display.contentHeight )
background:setReferencePoint( display.TopLeftReferencePoint )
background.x, background.y = 0, 0
local myRoundedRect = display.newRoundedRect(134, 134, 500, 748, 12)
myRoundedRect.strokeWidth = 8
myRoundedRect:setFillColor(214, 214, 214)
myRoundedRect:setStrokeColor(111, 111, 111)
local sfxSwitch = widget.newSwitch
{
left = 500,
top = 356,
initialSwitchState = true,
onPress = onsfxSwitchPress,
onRelease = onsfxSwitchRelease,
}
group:insert( background )
group:insert( myRoundedRect )
group:insert( sfxSwitch )
end
[/lua]
i marked where i want it to test the value and save it to my icebox
any help appreciated.