FF7fan
04-13-2005, 10:58 PM
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?
Hi,
I posted an answer to this on FK, but maybe it will help someone browseing this forum....
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...
_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();
}
}
NTD
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.