I have fixed the above issued and now want to know that,
Is there any way to detect multi-touch and simple touch on same object.
Because I want to assign different functionality on both the touch(single touch, multi-touch) event.
In my project, I have assigned page flip or swipe method using director book framework on touch event and I also want to do pinch zoom on same object on multi-touch or when user touches with two fingers.
I’m stuck now for couple of days.
Any help will be appreciated.
I am using this code for multi-touch but unable to get the number of touches > 2.
Is I am doing something wrong?
function bookBackground:touch( event )
if event.phase == “began” then
print(“in began phase”…self.numTouches )
display.getCurrentStage():setFocus( self, event.id )
self.numTouches = self.numTouches + 1
if self.numTouches >= 2 then
print( “This object is being multi-touched.” )
elseif event.phase == “cancelled” or event.phase == “ended” then
self.numTouches = self.numTouches - 1
if self.numTouches <= 0 then
display.getCurrentStage():setFocus( nil )
local bookBackground = display.newRect( 0, 0, _W, _H )
bookBackground.alpha = 0.01
bookBackground:addEventListener( “touch”, moveBookPage )
currView:insert( bookBackground )
bookBackground.numTouches = 0
bookBackground:addEventListener( “touch”, bookBackground )