Corona触摸事件?

如何将整个显示屏幕注册为事件监听器?

原文链接 https://stackoverflow.com/questions/5299995

点赞
stackoverflow用户102388
stackoverflow用户102388

创建 main.lua 并添加以下代码:

function drawLine( event )
  if(event.phase == "ended") then
    line = display.newLine(event.xStart, event.yStart, event.x, event.y)
    line:setColor(255,0,0)
    line.width = 5
  end
end
Runtime:addEventListener("touch", drawLine)

当然,一定要查看这个网站:http://developer.anscamobile.com/resources/docs

2011-03-21 15:20:26
stackoverflow用户686008
stackoverflow用户686008

将事件监听器添加到 Runtime。


add the event listener to Runtime
2011-04-06 15:41:30