App doesn't detect touch event in a specific screen area

local rect = display.newRect(870,100,10,10) means that the rect size is width=10, height=10 located at position x=870 y=100.

Also the anchor points are by default 0.5 which means the center-point of the rect will be positioned at the x,y coordinates given to newRect() 

Yes I know. By the way, let’s say that the screen width is 1200, and the height is 800, if rect.x < 600 (width/2) it works, but If rect.x is > than 600, it won’t. I’ve also tried (using iPhone 4/4s resolution in landscape mode [960x640]) to use a 960x640px image (adding the same event listener as above) and on the right side (the area marked with “X”) it doesn’t perform the event associated. 

OK try this:

local rect = display.newRect(display.contentCenterX, display.contentCenterY, 1200, 800) local function helloWorld() print("Hello World") end rect:addEventListener("touch", helloWorld)

Tried, same as before. I’m using the director class, could be that?

Aha! I believe so.

As far as I know, the director class isn’t Graphics 2.0 compatible. (I’ve never used it myself)

yes director is the problem
if you search the forum you will find how to get around this

yes director is the problem
if you search the forum you will find how to get around this

Ok thanks anyway :slight_smile:

Thanks Jstrahan! have you got a link to a thread about that?

 

sure but if you don’t learn how to search the forums for answers you gonna run into problems. took me less then a minute to find
http://forums.coronalabs.com/topic/43375-touch-events-in-graphic-20/

yes sorry you’re right, infact as soon as I asked you I’ve started to search around the forum and find some useful threads (including the one you’ve posted). Thanks anyway!