[Fixed] widget button with imageSheet problem

I’m using daily build 825, and I tried to create a button that uses imageSheet. I followed the instruction from this tutorial/blog post: http://blog.anscamobile.com/2012/05/adding-buttons-to-your-games-and-apps/

I am able to create a button when I don’t use imageSheet, but when I use imageSheet, it won’t show the image at all.

Here’s how I create a button with two images:

-- myFontSize and myFont are predefined variable  
-- this button looks and works as expected  
local myButton = widget.newButton{  
 default = "PNG/btnBlue.png",   
 over = "PNG/btnBlueOver.png",  
 width = 200,  
 height = 60,  
 label = "MY BUTTON",  
 labelColor = { default={255}, over={255} },  
 fontSize = myFontSize,  
 font = myFont,  
 onRelease = changeScene,  
 emboss = true  
}  
myButton.x = 0.5\*display.contentWidth; myButton.y = 0.5\*display.contentHeight;  
localGroup:insert(myButton);   

Here’s how I create a button with an imageSheet:

local mySheetOption = {  
 width = 200,   
 height = 60,  
 numFrames = 2,  
 sheetContentWidth = 200,  
 sheetContentHeight = 120  
 }  
local mySheet = graphics.newImageSheet( "PNG/btnBlueSheet.png", mySheetOption )  
  
-- myFontSize and myFont are predefined variable  
-- this button does not show imageSheet, but instead, looks like a white rounded rectangle with black stroke  
local myButton = widget.newButton{  
 sheet = mySheet,  
 defaultIndex = 1,  
 overIndex = 2,  
 width = 200,  
 height = 60,  
 label = "MY BUTTON",  
 labelColor = { default={255}, over={255} },  
 fontSize = myFontSize,  
 font = myFont,  
 onRelease = changeScene,  
 emboss = true  
}  
myButton.x = 0.5\*display.contentWidth; myButton.y = 0.5\*display.contentHeight;  
localGroup:insert(myButton);  

What am I don’t wrong with the imageSheet version?

Naomi [import]uid: 67217 topic_id: 26852 reply_id: 326852[/import]

I submitted a bug report (case #14577) with a test project that shows the problem I’m having. Hopefully, I’ll hear back with a response with (1) correction to my implementation of the imageSheet with widget button, and/or (2) updated tutorial blog post to demonstrate how to implement imageSheet with the widget button, or (3) possible bug fix.

Naomi [import]uid: 67217 topic_id: 26852 reply_id: 109118[/import]

Let me know if it gets solved.
+1 [import]uid: 135569 topic_id: 26852 reply_id: 109320[/import]

A quick update: I received an email reply to the bug report (case #14577) saying it is indeed a bug and a fix will be available in one of the next few daily builds.

Thanks, Ansca Team!

Naomi [import]uid: 67217 topic_id: 26852 reply_id: 109379[/import]

Thanks for the information Naomi! [import]uid: 135569 topic_id: 26852 reply_id: 109384[/import]

Oh that’s great!

I’m having the same issue as you, hopefully it get’s resolved soon. [import]uid: 123298 topic_id: 26852 reply_id: 109385[/import]

Have you had a chance to download the newest build 827 Naomi?

It looks like they fixed it. It’s working now on my end.

Thanks for the fix Ansca! [import]uid: 123298 topic_id: 26852 reply_id: 109505[/import]

Thanks, @Axie Studios, for the alert. I’ll download the new build! And thanks, Ansca, for the fix!

Cheers,
Naomi [import]uid: 67217 topic_id: 26852 reply_id: 109514[/import]

Just a heads up.

There’s still a bug where if the image frame = 1 the button won’t show the graphic.

It will show the rounded rectangle again.

I reported this as a bug, don’t know if I did it right though. First time reporting one. [import]uid: 123298 topic_id: 26852 reply_id: 109539[/import]

Hey, @Axie Studios, thanks for reporting that bug. Do you have a case number (Ansca bug system would send you a case number via email after you submit the bug.) If you do, will you post it under this thread: https://developer.anscamobile.com/forum/2012/05/29/some-animations-attempt-use-frame-0

Thanks again!

Naomi [import]uid: 67217 topic_id: 26852 reply_id: 109546[/import]

Done and done! [import]uid: 123298 topic_id: 26852 reply_id: 109565[/import]

Total dummy over here.

I forgot to add "sheet = " under the new.widgetButton settings.

Seems to work fine if the widget button has index 1. So this bug has been fixed.

My mistake, I will now walk away with my head down in shame. [import]uid: 123298 topic_id: 26852 reply_id: 109595[/import]

Okay, @Axie Studios. Don’t be feeling so down. We all make mistakes.

So… is the bug you reported unrelated to the other issue we found on the other thread I linked on post #9 above? If so, and if no one has reported the issue so far, maybe I’ll put together a quick test case.

Naomi
[import]uid: 67217 topic_id: 26852 reply_id: 109599[/import]

Well…I reported the sprite frame 1 issue that we found in the other thread and the second part of that bug report was about it not working for the widget button either.

But the widget button does actually work. This was my mistake.

I also don’t know if the OP of the other thread ever actually submitted it as a bug.

If I remember correctly, the sprite did actually play but it would throw up that error.

I haven’t tested to see if having index 1 as a frame in a sprite creates the animation without an error with the latest build. [import]uid: 123298 topic_id: 26852 reply_id: 109608[/import]

@Axie Studios, thank you for letting me know. I put together a quick test project, and it throws out warnings even with 827 (bug case #14647) – but as you noted, the animation seems to play fine despite. It would be nice if the warning goes away (that is, if it is a false alarm) – because when I first saw it, I simply decided not to create a sequenceData with multiple names.

Now it looks like I should ignore the warning and use the sequenceData the way I originally wanted to use.

Naomi [import]uid: 67217 topic_id: 26852 reply_id: 109612[/import]

I am investigating these bugs for you guys now, thanks for reporting [import]uid: 84637 topic_id: 26852 reply_id: 109657[/import]

Thank you, Danny! I appreciate it.

Naomi [import]uid: 67217 topic_id: 26852 reply_id: 109726[/import]