Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

[FIXED] Touch doesn't work
Started by searchm Oct 10 2013 06:18 AM

14 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

searchm

[GLOBAL: userInfoPane.html]
searchm
  • Contributor

  • 187 posts
  • Corona SDK

Hey there,

 

I opened my current project with your new graphics 2.0 built and set the graphicsCompatibility mode to 1. everything looks the way it was but I can not click anything, no listener seems to work, nothing seems to happen. don't get any error message either. why is that?

 

really excited about it btw.



[TOPIC: post.html]
#2

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

Mac OSX 10.8.5

Graphics 2.0 build 2001

Corona Simulator

 

That's a bit weird. I took one of my apps and enabled V1 compatibility mode, and it works as expected.

It's a business app using widgets though, if that makes a difference...



[TOPIC: post.html]
#3

Bryan01

[GLOBAL: userInfoPane.html]
Bryan01
  • Enthusiast

  • 95 posts
  • Corona Staff

@romanfischer

 

We found one issue with touch events and masking that was fixed as of the last daily build.  Is your project using masking?

If you can attach a small bit of sample code we can try to reproduce the issue.



[TOPIC: post.html]
#4

searchm

[GLOBAL: userInfoPane.html]
searchm
  • Contributor

  • 187 posts
  • Corona SDK

thanks for your quick reply.

 

well, how about this:

 

local test = display.newText('hello',0,0,"Arial",16)

test.x = display.contentWidth / 2
test.y = display.contentHeight / 2

function touchlistener(event)

	if event.phase == "began" then

		print('test')

	end

end

test:addEventListener("touch", touchlistener)

doesn't work in build 2013.2001 nor in build 2013.2000

works in build 2013.1225

 

did the method change? am I doing something wrong? Doesn't matter if it's a text or an image btw..

 

I'm on Mac OSX

 

edit: I tried this code in a new blank app



[TOPIC: post.html]
#5

Bryan01

[GLOBAL: userInfoPane.html]
Bryan01
  • Enthusiast

  • 95 posts
  • Corona Staff

I tested your sample with build 2001 and everything appears to be working normally with the test message going to the console window correctly. It was tested with compatibility mode on and off.



[TOPIC: post.html]
#6

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

Mac OSX 10.8.5

Corona Graphics 2.0 build 2001

Corona Simulator

 

I can also confirm that the test code given above works for me as well.

The "test" message is printed in the console when "hello" is tapped.



[TOPIC: post.html]
#7

searchm

[GLOBAL: userInfoPane.html]
searchm
  • Contributor

  • 187 posts
  • Corona SDK

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.



[TOPIC: post.html]
#8

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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... 



[TOPIC: post.html]
#9

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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



[TOPIC: post.html]
#10

jacques1

[GLOBAL: userInfoPane.html]
jacques1
  • Contributor

  • 318 posts
  • Corona SDK

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 )
 


[TOPIC: post.html]
#11

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

@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  :)



[TOPIC: post.html]
#12

rakoonic2

[GLOBAL: userInfoPane.html]
rakoonic2
  • Contributor

  • 503 posts
  • Corona SDK

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?

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 :)

[TOPIC: post.html]
#13

jacques1

[GLOBAL: userInfoPane.html]
jacques1
  • Contributor

  • 318 posts
  • Corona SDK

@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.



[TOPIC: post.html]
#14

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

@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 ) 


[TOPIC: post.html]
#15

searchm

[GLOBAL: userInfoPane.html]
searchm
  • Contributor

  • 187 posts
  • Corona SDK

My problem resolved since build 2013.2004.

The touch events are working again on Mac OSX 10.7.5




[topic_controls]
[/topic_controls]