local scene1 = director:createScene()
director:createLabel(dw/2, dh/2, "Scene 1")
local scene2 = director:createScene()
director:createLabel(dw/2, dw/2, "Scene 2")
local touch = function(event)
print("phase - > "..event.phase)
if event.phase == "ended" then
if director:getCurrentScene() == scene1 then
director:moveToScene(scene2)
print("moveToScene - >scene2 ")
else
director:moveToScene(scene1)
print("moveToScene - >scene1 ")
end
end
end
system:addEventListener("touch", touch)
local scene1 = director:createScene() director:createLabel(dw/2, dh/2, "Scene 1")
local scene2 = director:createScene() director:createLabel(dw/2, dw/2, "Scene 2") local touch = function(event) print("phase - > "..event.phase) if event.phase == "ended" then if director:getCurrentScene() == scene1 then director:moveToScene(scene2) print("moveToScene - >scene2 ") else director:moveToScene(scene1) print("moveToScene - >scene1 ") end end end system:addEventListener("touch", touch)
director:getCurrentScene() is error.