...

View Full Version : countdown with sound



jarv
07-22-2009, 11:48 AM
ok so I have a 30 second count down with a 14 second sound file which I have set to repeat 3 times so it spans more than 30 seconds. my problem is is that the sound continues to play after 30- seconds even though I added a stopAllSounds(); at the end of the countdown timer actionscript




//Minute countdowner (Minutnedršknaren)
//By Kenneth Andersson aka Kenzilla, 2006.
//Use it however you like.
//
//First we need a dynamic textfield with instance name "theText", check.
//Then we set the total number of minutes. I picked 64 to reduce the
//result-view-waiting-time. 119 would just be... boring.
total = 30;
//Calculate the var total and update the textfield.
this.onEnterFrame = function() {
minutes = Math.floor(total/60);
seconds = total%60;
if (seconds<=9 && minutes<=9) {
theText.text = "0"+minutes+" : "+"0"+seconds;
} else if (seconds<=9) {
theText.text = minutes+":"+"0"+seconds;
} else if (minutes<=9) {
theText.text = "0"+minutes+" : "+seconds;
} else {
theText.text = minutes+" : "+seconds;
}
};
//Function for the countdown, can be changed to total++ if you want to
//count "into the future" or something. Well I dunno.
//clearInterval = When minutes and seconds is 00:00 it stops.
counter = function () {
total--;
if (minutes == 0 & seconds == 1) {
clearInterval(setIt);
}
};
//Then we start an interval with the counter function, 1000 is milliseconds Š 1 sec.
setIt = setInterval(this, "counter", 1000);

stop();

jarv
07-24-2009, 10:33 AM
can anyone help here?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum