How to handle touch and tap at the same time

Hello guys

I ve 2 object obj1 and obj2

When i touch the obj1 I call the display.getCurrentStage():setFocus( obj1). Now I should touch the obj2 to make something but  if I try to touch the obj2 nothing happens even if I activated the multitouch (system.activate(“multitouch”)).  How can I solve this problem. I would like to touch the obj2 while obj1 is focused.

Something like RobberyBob in which you can move the character around the scenario using the pad at the bottom left corner and at the same time you can increase the speed touching the other button at the bottom right corner.

Thanks in advance guys

you should pass the event.id to setFocus() when using multitouch - as you only want “obj1” to capture focus for that specific touch

Can you make an example please?

local function onButtonTouch(event) if (event.phase=="began") then display.getCurrentStage():setFocus(event.target, event.id) --etc

Hi @briesanji,

I wrote a tutorial on this awhile back which might help you:

http://coronalabs.com/blog/2013/10/01/tutorial-taptouch-anatomy/

Take care,

Brent

Thanks for your help guys

you should pass the event.id to setFocus() when using multitouch - as you only want “obj1” to capture focus for that specific touch

Can you make an example please?

local function onButtonTouch(event) if (event.phase=="began") then display.getCurrentStage():setFocus(event.target, event.id) --etc

Hi @briesanji,

I wrote a tutorial on this awhile back which might help you:

http://coronalabs.com/blog/2013/10/01/tutorial-taptouch-anatomy/

Take care,

Brent

Thanks for your help guys