你可以使用这个:
local button = display.newImage( "namehere" )
function touchHandler( event )
if event.phase == "began" then
-- Do stuff here --
display.getCurrentStage():setFocus(event.target)
event.target.isFocus=true
elseif event.target.isFocus == true then
if event.phase == "moved" then
if inBounds( event ) then
-- Do stuff here --
else
-- Do stuff here --
display.getCurrentStage():setFocus(nil)
event.target.isFocus=false
end
elseif event.phase == "ended" then
-- Do stuff here --
-- Send mail here
-- Send mail here
-- Send mail here
display.getCurrentStage():setFocus(nil)
event.target.isFocus=false
end
end
end
button:addEventListener( "touch", touchHandler )