Buttons not working when placed on the right side of the game screen

I’m having problems with my buttons not working if they are within about 100 or less pixels away from the right side of the game screen. This happens whether they are in a game group or not. When I move the buttons to the middle of the screen or to the left side, they work perfectly fine.

Is this a common problem? If it is, is there a way to fix it? I searched the forums and didn’t see anyone addressing a problem like this. [import]uid: 45667 topic_id: 28751 reply_id: 328751[/import]

What device are you simulating? Can you show some code positioning a button + your config.lua settings, please? [import]uid: 52491 topic_id: 28751 reply_id: 115892[/import]

I’m working with the iPhone. I have the same problem on the simulator and with the actual device.

Here is a button sample code:

 nextBtn = ui.newButton{  
 defaultSrc = "nextlevelbtn.png",  
 defaultX = 120,  
 defaultY = 120,  
 overSrc = "nextlevelbtn.png",  
 overX = 120,  
 overY = 120,  
 onEvent = onPlayTouch,  
 id = "nextButton",  
 text = "",  
 font = "Helvetica",  
 textColor = { 255, 255, 255, 255 },  
 size = 16,  
 emboss = false  
 }  
  
 nextBtn:setReferencePoint( display.BottomCenterReferencePoint )  
 nextBtn.x = 650 nextBtn.y = 600  

And here is the config.lua code for it:

application =  
{  
 content =  
 {  
 width = 635,  
 height = 540,  
 scale = "Letterbox",  
 fps = 30,  
 antialias = false,  
  
 imageSuffix =  
 {  
 ["@2x"] = 2,  
 ["@57"] = 1,  
 ["@72"] = 1.26,  
 ["@512"] = 9,  
 },  
 },  
}  

Thanks again. [import]uid: 45667 topic_id: 28751 reply_id: 115972[/import]

Width, Height, X and Y are all messed up.

In config.lua set width to 320 and height to 480. Then go and reposition your button accordingly and let me know how you go, OK?

Peach :slight_smile: [import]uid: 52491 topic_id: 28751 reply_id: 116047[/import]

Oh, so the only way to avoid problems like the one I am having is to use those dimensions? I had to change the width and height because my animator wanted to use those dimensions for whatever reason.

If there’s no way to fix it without changing the dimensions to the ones you gave me then I’ll just avoid placing buttons on the right side of the screen. We’re at the final stages of the game and changing the width/height/x/y of everything would be a much bigger inconvenience compared to just avoiding the right side for buttons. [import]uid: 45667 topic_id: 28751 reply_id: 116157[/import]

No you don’t need to use those dimensions in all cases but if you are developing for iPhone then yes, you must use those.

You need to understand that right now what you are doing is saying you are developing for a screen that is 635 x 540 - so it’s like this landscape rect shape, a little wider than a square.

The iPhone screen is not that shape - it’s a rectangle 320x480. The above is like a wide, flipped rectangle. So yeah, you’re coding for a screen that size, which is not what you are running on, it’s not going to work well because of this. [import]uid: 52491 topic_id: 28751 reply_id: 116211[/import]

Oh ok, I get it. Thanks for the explanation. It makes sense. [import]uid: 45667 topic_id: 28751 reply_id: 116284[/import]