local scheduler = require(cc.PACKAGE_NAME .. ".scheduler")
local MainScene = class("MainScene", function()
return display.newScene("MainScene")
end)
function MainScene:ctor()
local label=cc.ui.UILabel.new({
UILabelType = 2, text = "test hero move control", size = 32})
:align(display.CENTER, display.cx, display.cy+150)
:addTo(self)
local handle
local interval = 1
local repeatIndex = 3
local index = 0
handle = scheduler.scheduleUpdateGlobal(function()
index = index + 1
label:setString(string.format("%d", index))
if index >= repeatIndex then
scheduler.unscheduleGlobal(handle)
print("over")
end
end)
end
return MainScene