This code run as main.lua shows the problem (if you have the correct graphics, anyway):
local widget = require("widget") local options = { frames = { { x=0, y=40, width=15, height=40 }, { x=30, y=0, width=15, height=40 }, { x=0, y=0, width=15, height=40 }, { x=15, y=40, width=15, height=40 }, { x=45, y=0, width=15, height=40 }, { x=15, y=0, width=15, height=40 }, { x=30, y=40, width=6, height=40 } }, sheetContentWidth = 64, sheetContentHeight = 128 } local segmentSheet = graphics.newImageSheet( "SegmentedControl.png", options ) local segmentedControl = widget.newSegmentedControl { x = display.contentCenterX, y = 85, segmentWidth = 120, segments = { "Arcade", "Strategy" }, defaultSegment = def, labelSize=20, labelColor = { default={ 0.5, 0.5, 0.5 }, over={ 1, 1, 1 } }, sheet = segmentSheet, leftSegmentFrame = 1, middleSegmentFrame = 2, rightSegmentFrame = 3, leftSegmentSelectedFrame = 4, middleSegmentSelectedFrame = 5, rightSegmentSelectedFrame = 6, segmentFrameWidth = 15, segmentFrameHeight = 40, }
If you want a project consisting of that file plus the graphics, here it is:
http://gamedevnation.com/files/SegControlProblem.zip
Thanks.
Jay