Corona SDK:想要在音频结束时更改场景(不起作用)。

所以我已经设置好了。声音有效。如果直接调用函数,则endGame函数也起作用,在scene:create(event)中。 但是当我从声音的onComplete方法中调用函数时,函数会触发,但是在声音停止播放后,我会得到这条消息“尝试调用一个空值”。

media.playSound(quotepath,{onComplete = endGame})

功能:

function endGame()
   composer.gotoScene(“scenes.gameover”,“fade”,500end
点赞
用户2653067
用户2653067

下面是正确的语法:

local onComplete

onComplete = function(event)
    print("声音播放完毕")
end

media.playSound("song1.mp3", onComplete)
2015-09-10 04:44:40