2013-07-27 20 views
0
獲取畫面過渡效果工作

我有問題。我嘗試了支持的淡入淡出效果和crossFade效果,但是當過渡發生時,它是直接的,沒有淡化效果。其他一切正常,我沒有錯誤。我究竟做錯了什麼?電暈/ Lua的:屏幕轉換不工作

local storyboard = require ("storyboard") 
local scene = storyboard.newScene() 

local loading = require ("loading") 
local loading = loading.new() 

function switch() 
    storyboard.gotoScene("scene1","fade", 700) 
end 

function scene:enterScene(event) 
    timer.performWithDelay(2000,switch,1) 
end 
scene:addEventListener("enterScene", scene) 

return scene 

我也曾嘗試

function switch() 
    storyboard.gotoScene("scene1",{effect="fade", time=700}) 
end 

local options = {effect="fade", time=700} 

function switch() 
    storyboard.gotoScene("scene1", options) 
end 

回答

1

一個常見的錯誤是,你忘了你的視圖元素添加到self.view組。通常,故事板模板在場景的開頭包含本地組= self.view:createScene函數。嘗試將視圖對象插入到該組中。然後重試您的轉場。

+0

此外,你需要添加它們在createScene()。如果您一直等到enterScene()創建您的顯示,那麼直到空場景轉換到屏幕上纔會發生。 –