Hi
Am trying to customise the onOffSwitch with custom graphics, but can’t seem to get it to work. It always just takes one frame and duplicates it.
Here’s some sample code, am I missing something?
local sheetData = { width=225, height=56, numFrames=2, sheetContentWidth=225, sheetContentHeight=112 } local starSheet = graphics.newImageSheet( "images/btnOnOff.png",sheetData ) local starData = { name = "off", frames = {1,2} } local onOffSwitch = widget.newSwitch { left = 100, top = 100, frameOff = 1, frameOn = 2, data = starData, width = 25, height = 16, id = "My on/off switch widget", initialSwitchState = false, sheet = starSheet, onOffBackgroundFrame = 1, onOffBackgroundWidth = 225, onOffBackgroundHeight = 16, onOffOverlayWidth = 25, onOffOverlayHeight = 56, onOffOverlayFrame = 2, onOffHandleDefaultFrame = 1, onOffHandleOverFrame = 2, onRelease = onSwitchPress }
Have tried various combinations, different sizes, different numbers of frames, but cannot get more than one frame to display when you click on the switch. The attached file has two frames, but can only get the second one to display using the above code.
Or, does anyone have a working version of a customised switch, I could look at?
Thanks