restart problems

I am having a continuous problem trying to get my game to restart. I have veiwed many of the other threads and have tried them but to no avail.
I have this function to reload the level

function button:tap()
director:changeScene( loadLevel, “crossfade” )
button:addEventListener(‘tap’, button)
end

whenever I test the game out it says that add event listener is nil any help would be greatly appreciated. [import]uid: 94237 topic_id: 15818 reply_id: 315818[/import]

You need to assign listener outside the function, or listener will be added after touching button [import]uid: 16142 topic_id: 15818 reply_id: 58451[/import]

ok i see, does it matter where this other listener goes? [import]uid: 94237 topic_id: 15818 reply_id: 58490[/import]

@shakmbakm,
I guess that stands for Shake’em Bake’em? if not sorry for the guess.

To your question, think of it as a procedure

Procedure when the AlarmRings => Procedure1
START
Do step 1
Do step 2
Do step 3
END

Now you need to let everyone know that the procedure for an Alarm ringing is in place, so you would say

Procedure for ALARM_RING is Procedure1
Now if you made this note inside of procedure1, how would anyone know that there existed a procedure1 and that is for AlarmRinging

In other words, think of a book, if you had a TOC inside a chapter somewhere, how would you know where that chapter is?

hope that makes sense,

cheers,

?:slight_smile:
[import]uid: 3826 topic_id: 15818 reply_id: 58495[/import]

yes you are correct about my name. And thanks for the answer that helps out a lot! [import]uid: 94237 topic_id: 15818 reply_id: 58800[/import]