Check out senocular's tutorial on
kirupa.
If you are not familiar with setInterval, you can always use an onEnterFrame function to help you. For example:
ActionScript Code:
//This is in AS2
var i:Number = 1
onEnterFrame = function(){
if (playerIsDead == true) {
i++
if (i > 250) {
i = 1
//Add your player respawn function here
playerIsDead = false
}
}
}
Assuming that your framerate is 25 fps, then your player would respawn after 10 seconds, as 25*10 = 250 Change the number 250 to whatever number you want.
Cheers!