-
Simple Countdown Timer
I just want to make a simple countdown timer, that everytime the flash movie hits the timers keyframe it counts down from 10 and then plays a sound. Is there a way to do this?
-
Banned
Hi,
Flash allows for many ways to accomplish the same task. In this case, you could use a movieclip 120 frames long(assuming your movie frame rate is 12 fps), place a number every 12 frames..... 10,9,8,etc,.... then, on the last frame of the movieclip, have a stop action and a sound on the frame.
Another method might be to use nothing but actionscript to achieve the same effect.Paste this code onto a frame and test, you will need a sound in your library set to export for actionscript with an ID name...
code:
_root.createEmptyMovieClip("countDown", 10);
cCenterX = Stage.width/2;
cCenterY = Stage.height/2;
_root.countDown.counter._x = cCenterX;
_root.countDown.counter._x = cCenterY;
_root.countDown.createTextField("myTextField", 1, cCenterX, cCenterY, 30, 20);
_root.countDown.myTextField.background = true;
_root.countDown.myTextField.autoSize = "center";
_root.countDown.myTextField.border = true;
_root.countDown.myTextField.backgroundColor = 0x00FFCC;
count = 10;
myCountDown = function () {
count--;
};
countInterval = setInterval(myCountDown, 1000);
this.onEnterFrame = function() {
_root.countDown.myTextField.text = count;
if (count == 0) {
clearInterval(countInterval);
_root.countDown.myTextField.text = "00";
mySound = new Sound();
mySound.attachSound('soundID');
mySound.start();
}
}
-
It works now, thanks for the help.
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
|