Hi, I am trying to create a simple switch using the code below
local widget = require("widget")
local myTxt = display.newText("Hello", 0, 0, native.systemFontBold, 40)
myTxt.x = display.screenOriginX + display.viewableContentWidth\*0.5
myTxt.y = 50
myTxt:setTextColor(255)
local myBtn = widget.newSwitch {
id = "myswitch",
width = 50,
height = 50,
sheet = "btn\_radio\_onoff.png",
data = "btn\_radio\_onoff",
frameOff = "btn\_radio\_off",
frameOn = "btn\_radio\_on",
initialSwitchState = false,
style = "radio"
}
myBtn.x = display.screenOriginX + display.viewableContentWidth\*0.5
myBtn.y = display.screenOriginY + display.viewableContentHeight\*0.5
I am using Widget 1.0 on build 1033. It keeps failing with the error shown below
2013-03-11 23:19:36.303 Corona Simulator[18987:f03] Version: 2.0.0
2013-03-11 23:19:36.303 Corona Simulator[18987:f03] Build: 2013.1033
2013-03-11 23:19:36.311 Corona Simulator[18987:f03] The file sandbox for this project is located at the following folder:
(/Users/shiva.paranandi/Library/Application Support/Corona Simulator/testRadio-39EE1563B5FBE985810075DC147F34EF)
2013-03-11 23:19:36.314 Corona Simulator[18987:f03] Runtime error
?:0: attempt to index a nil value
stack traceback:
[C]: ?
?: in function <?:453>
(tail call): ?
/Users/shiva.paranandi/Shiva/testRadio/main.lua:8: in main chunk
2013-03-11 23:19:36.314 Corona Simulator[18987:f03] Runtime error:
2013-03-11 23:19:36.315 Corona Simulator[18987:f03] ?:0: attempt to index a nil value
stack traceback:
[C]: ?
?: in function <?:453>
(tail call): ?
/Users/shiva.paranandi/Shiva/testRadio/main.lua:8: in main chunk
Any help is highly appreciated.
Thanks. [import]uid: 103483 topic_id: 37573 reply_id: 67573[/import]