Ui button Rect

I am trying to adjust my games so they use the “rect”, but it has been giving me some problems. At first my UI button worked, but that was on UI version 1.1. I realized that it was now up to 2.4 so i downloaded it, and put it into my application. The button no longer worked, so i looked and found that there was a different way of writing the buttons.

 local btn = ui.newButton{  
 defaultSrc = "images/clickhere.png,  
 overSrc = "images/clickheredown.png,  
 overAlpha = .5,  
 overScale = 1.1,  
 onEvent = ButtonTouch,  
 id = "Button",  
 }  
  

Can someone help me out with what I’m doing wrong?

Thanks [import]uid: 24708 topic_id: 22432 reply_id: 322432[/import]

Without seeing the specific UI code for the 2.4 you’re using, I can only speculate that you need to provide some width and height’s for the default and over if 2.4 is using display.newImageRect() for retina graphics.

I have a 1.5 version that has parameters: defaultX, defaultY, overX and overY (though X and Y are not X and Y but Width and Height in reality)

Look in your ui,lua for the “newButton” function and see what parameters it’s expecting.

EDIT: I should point out that ui.lua and movieclip.lua are a little problematic because people have updated them and haven’t kept the version numbers up to date, or you have two different people putting out a 2.4 that behave differently. You really are on your own to figure out what your particular copy does. [import]uid: 19626 topic_id: 22432 reply_id: 89463[/import]

i looked in my UI.lua code and found the following

 local button, defaultSrc , defaultX , defaultY , overSrc , overX , overY , overScale , overAlpha , size, font, textColor, offset  

Im guessing these are the parameter you are talking about.

Thanks for your help!
Ill let you know if i can get it working! [import]uid: 24708 topic_id: 22432 reply_id: 89464[/import]

I just managed to get the UI button working, but the Rect does not seem to work. Does anyone have the same problem? [import]uid: 24708 topic_id: 22432 reply_id: 89473[/import]