Getting Error Using Button Widget In Build 2013.1076

hello,

  I’ve updated to build 2013.1076.

  This code worked fine before updating:

    local btnPlayImageSheet = graphics.newImageSheet(“img/preloader/btnPlay.png”, { width = 120, height = 060, numFrames = 2, sheetContentWidth = 240, sheetContentHeight = 060 } )

    local btnPlay = widget.newButton { sheet = btnPlayImageSheet, defaultIndex = 1, overIndex = 2, width = 120, height = 060, onRelease = btnPlayReleased }

    localGroup:insert(btnPlay)

    btnPlay:setReferencePoint(display.BottomRightReferencePoint)

    btnPlay.x = 310

    btnPlay.y = 470

  now I receive this message:

2013-04-05 14:17:23.250 Corona Simulator[33764:707] WARNING: Sequence (over) has an invalid count (1) that makes the last frame index of the sequence (4) fall outside the range of valid image sheet frame indices: 1 <= index <= 2.

Thanks.

hi again,

  now I’m not using ImageSheet and is working fine:

local btnPlay = widget.newButton{

        width = 120, 

        height = 060,

        defaultFile = “img/preloader/btnPlayDefault.png”,

        overFile = “img/preloader/btnPlayOver.png”,

        onRelease=btnPlayReleased

    }

    localGroup:insert(btnPlay)

    btnPlay:setReferencePoint(display.BottomRightReferencePoint)

    btnPlay.x = 310

    btnPlay.y = 470

Thanks.

hi again,

  now I’m not using ImageSheet and is working fine:

local btnPlay = widget.newButton{

        width = 120, 

        height = 060,

        defaultFile = “img/preloader/btnPlayDefault.png”,

        overFile = “img/preloader/btnPlayOver.png”,

        onRelease=btnPlayReleased

    }

    localGroup:insert(btnPlay)

    btnPlay:setReferencePoint(display.BottomRightReferencePoint)

    btnPlay.x = 310

    btnPlay.y = 470

Thanks.

Same error - strange behaviour when using spritesheets in buttons :frowning:

Hi @jcsastre, dilix90,

In the case of image sheets and widget buttons, there is no “defaultIndex” or “overIndex” parameters. This is probably why it wasn’t working. Neither do those parameters exist for standard image-based (non-sheet) buttons. For those, the parameters are “defaultFile” and “overFile”… and for image sheets, it’s “defaultFrame” and “overFrame”.

Please see the documentation here:

http://docs.coronalabs.com/api/library/widget/newButton.html

Sincerely,

Brent Sorrentino

Hi @Brent Sorrentino,

Oh, thank’s a lot ! :slight_smile:

Next time i will look carefully in official docs :slight_smile:

I thinks this question take place from tutorial in corona blog (http://www.coronalabs.com/blog/2012/05/22/adding-buttons-to-your-games-and-apps/) - here it (default\over)Index.

Same error - strange behaviour when using spritesheets in buttons :frowning:

Hi @jcsastre, dilix90,

In the case of image sheets and widget buttons, there is no “defaultIndex” or “overIndex” parameters. This is probably why it wasn’t working. Neither do those parameters exist for standard image-based (non-sheet) buttons. For those, the parameters are “defaultFile” and “overFile”… and for image sheets, it’s “defaultFrame” and “overFrame”.

Please see the documentation here:

http://docs.coronalabs.com/api/library/widget/newButton.html

Sincerely,

Brent Sorrentino

Hi @Brent Sorrentino,

Oh, thank’s a lot ! :slight_smile:

Next time i will look carefully in official docs :slight_smile:

I thinks this question take place from tutorial in corona blog (http://www.coronalabs.com/blog/2012/05/22/adding-buttons-to-your-games-and-apps/) - here it (default\over)Index.