0
votes

So I have this set up. The sound works. The endGame function also works if the function is called directly, in the scene:create( event ). But when I call the function from the onComplete method in the sound, the function triggers, but the i get this message "attempted to call a nil value" after the sound stops playing.

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

the function:

function endGame()
composer.gotoScene( "scenes.gameover", "fade", 500 )
end
1
can you post the console log error? - JLONG
Runtime error attempt to call a nil value - Stephen M. Yantz

1 Answers

1
votes

This how the syntax should be of,

 local onComplete

 onComplete = function(event)
    print( "sound play ended" )

end

media.playSound( "song1.mp3", onComplete )