Hi all,
I would like to ask all of you regarding Dragging Object issue.I am having a difficulties with dragging image object.
The following are code portion that faced the issue,
function paInstance1:touch( event ) if event.phase == "began" then display.getCurrentStage():setFocus( self, event.id ) self.isFocus = true self.markX = self.x -- store x location of object self.markY = self.y -- store y location of object elseif event.phase == "moved" then local x = (event.x - event.xStart) + self.markX local y = (event.y - event.yStart) + self.markY self.x, self.y = x, y -- move object based on calculations above elseif ( event.phase == "ended" or event.phase == "cancelled" ) then print ("X=",event.x) print ("Y=",event.y) if event.x \>370 and event.x \< 690 and event.y \> 360 then if Ans =="1" then displayCorrectAnimation() end end end return true end paInstance1:addEventListener( "touch",paInstance1 )
The issue is : When I drag a object,I cannot drag another object to move.
and When I swipe the background image,the image object on top of the background also move (The touch area of that image object is so big).I didn’t add event listener to BackGround Image in order to move)
May I know how to overcome the above two problems and how to decrease the touch area of a object?
Best Regards,
John