[FIXED] Touch doesn't work

thanks for your feedback.

Okay but that’s so weird. why is it so? What version of xcode do you have? I have like 4.6, still stuck with ios sdk 6… that’s the only thing I can think of. But shouldn’t be the reason when I test in coronas simulator, right?

Mac OSX 10.7.5

strange.

OK, that’s one difference. 

I’ve got Xcode version 5.0 (5A1413) installed but, as you say, it shouldn’t affect testing in the Simulator.

If anything, I’d put my bet on that there might be some quirks with Lion as opposed to Mountain Lion.

Very strange… 

BTW, have you tried to compile for a device and tested it there?

Previously in v1.0 I was able to create an invisible tap-enabled box by setting its setfillcolor alpha to 0 (not its .alpha). Now it appears that this is no longer possible? If i set the fill alpha to anything greagter the 0 it naturally works but how do we now (in v2.0) create invisible tappable areas?

local halfW = display.viewableContentWidth / 2 local halfH = display.viewableContentHeight / 2 local button=display.newRect(halfW,halfH,50,50);button:setFillColor(1,1,1,1) -- setting alpha value to 0 in above setFillColor no longer registers tap event, -- in v1.0 it still registered function button:tap(event)     print("tapped") end button:addEventListener( "tap", button )  

@jacques1

I reported this back in August on this thread:

http://forums.coronalabs.com/topic/38350-objectishittestable-not-working/

It’s on their to-do list  :slight_smile:

[quote name=“jacques1” post=“209770” timestamp=“1381550857”]Previously in v1.0 I was able to create an invisible tap-enabled box by setting its setfillcolor alpha to 0 (not its .alpha). Now it appears that this is no longer possible? If i set the fill alpha to anything greagter the 0 it naturally works but how do we now (in v2.0) create ivisible tappable area?[/quote]I ran into this myself. The trick now is to make the object invisible, but set the ishittestable property to true. It actually works out quicker, but it did catch me out the first time :slight_smile:

@rakoonic

Cool, so i assume by invisible you mean .alpha=0 NOT setFillColor(x,x,x,0)?

I’ll try remember it when i start using 2.0 for finished apps once the bugs are better resolved.

@jacques1

Yes.

Here’s a snippet that shows the problem / bug / workarounds.

-- -- main.lua -- local background = display.newRect(0, 0, 100, 100); background.x = display.contentCenterX; background.y = display.contentCenterY; background.isHitTestable = true; ---- (ex 1) gfx 2.0 fill alpha bug --background:setFillColor(1, 0); ---- (ex 2) this will work --background.alpha = 0; ---- (ex 3) this will also work background.isVisible = false; background:addEventListener( "touch", function(event) print(event.phase, event.x, event.y); end )

My problem resolved since build 2013.2004.

The touch events are working again on Mac OSX 10.7.5