|
-
Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z
[F8] Countdown Timer Triggers and Event...possible?
Hi,
I have a timer counting down.
When it hits :30 I need a warning sound and message.
Not sure how to do this. I thought some kind of listener
Below is the code
Thanks
Code:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;
}else if (outputSec == 0) {
outputSec = "00";
gotoAndPlay(3);
}
}
}
chk=0;
stop();
-
Developing For Dunkets
Could you set your timer = to a variable, then check if the variable is = to 30, then have your action. Display your msg in a dynamic txtbox Something as simple as:
Code:
outputMin=1
outputSec=60
//all of your time code to countdown
if (outputMin=0 && outputSec<=30){
warning.text="Warning, your running out of time"
}
-
Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z
Thanks for the post.
I should have mentioned that AS is something that I am still tryng to get my head around. That said, I am not really sure how to add your solution to the code.
If you have time to show me that would be great.
Thanks again.
-
Developing For Dunkets
I'm sure that there is more to your code and I don't feel like completing this so I can test it, but I would guess that putting it like this should work.
Code:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputMin=0 && outputSec<=30){
warning="Warning, your running out of time"//displays the warning message in a dynamic textbox with the variable name "warning"
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;
}else if (outputSec == 0) {
outputSec = "00";
gotoAndPlay(3);
}
}
}
chk=0;
stop();
You have to set up a dynamic textbox with a variable name of warning for the message to display, Make sure that the textbox is long enough. That should work, but I can't say for sure without the rest of the code or seeing how you have the countdown running.
Last edited by mneil; 05-02-2007 at 11:24 AM.
Reason: remove the .text after warning
-
Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|