--ccui.Button的建立方法
ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png")
ccui.Button:create("crystal.png", "", "", ccui.TextureResType.plistType)ui
addClickEventListener(只在按鈕點擊觸發一次)orm
addTouchEventListener(按鈕點擊 擡起 移動 取消狀態觸發事件)事件
self:addTouchEventListener(function(sender, state)
local event = {x = 0, y = 0}
if state == 0 then
event.name = "began"
elseif state == 1 then
event.name = "moved"
elseif state == 2 then
event.name = "ended"
else
event.name = "cancelled"
end
event.target = sender
callback(event)
end)get