尝试这个:
local gear.rotation = 0
local function animate( event )
gear.rotation = gear.rotation + 10
end
Runtime:addEventListener("enterFrame", animate);
当您离开页面时,请致电:
Runtime:removeEventListener("enterFrame", animate);
director:changeScene("yourScene")
问题依然存在,试试下面的代码:
local bg = display.newRect(0,0,display.contentWidth,display.contentHeight) -- or simply create a background
-- create gear
local gear.rotation = 0
local function animate( event )
gear.rotation = gear.rotation + 10
end
bg:addEventListener("enterFrame", animate);
当您离开页面时,请致电:
bg:removeEventListener("enterFrame", animate);
director:changeScene("yourScene")
继续编码..... :)