[Answered] Widgets and Image Sheets

Is there a way to use a frame of an Image Sheet with a widget button?

local widget = require "widget"  
  
local button = widget.newButton{  
 default = "buttongraphic.png", over = "buttongraphic-over.png", width = 150,  
 height = 200  
}  

From Mr. Beebe:
"Jonathan Beebe May 23rd, 2012 at 8:34 am
Hi all —

Good news: imageSheet support in widget.newButton() is coming soon. In fact, it should be rolling out in one of the next few daily builds (not sure exactly which one it will be in). It’ll be easy too: you’ll simply specify ‘sheet’, ‘defaultIndex’, and ‘overIndex’ options instead of graphics files when creating the widget."

Source: http://blog.anscamobile.com/2012/05/adding-buttons-to-your-games-and-apps/ [import]uid: 73951 topic_id: 26689 reply_id: 326689[/import]

On build 825 here and can’t seem to get this to work. I just see a white square instead of the actual image.

The actual button itself seems to work. The white box gets highlighted when clicked and it takes me to the next page.

I’m using TexturePacker to create my texture sheet.

I have set up other buttons and images with this same sheet and everything else works fine. [import]uid: 123298 topic_id: 26689 reply_id: 109325[/import]

I can’t get it to work either. I have a functioning imageSheet, but using sheet, defaultIndex, and overIndex in widget.newButton() just gets me a roundedRect button as though I specified no image at all. [import]uid: 44647 topic_id: 26689 reply_id: 109372[/import]

I filed the bug report (case #14577), and I’m told a fix will be available in one of the next few daily builds. The bug is described here:

https://developer.anscamobile.com/forum/2012/05/28/help-widget-button-imagesheet-problem

Naomi [import]uid: 67217 topic_id: 26689 reply_id: 109386[/import]