Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default Simple Countdown Timer, help.

    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?

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    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...



    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();
    	}
    }
    NTD
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Countdown timer.. in flash 8
    By mattleeds in forum Games
    Replies: 1
    Last Post: 11-04-2006, 08:51 AM
  2. Scripting Countdown Timer
    By Lelock1 in forum Advanced Flash
    Replies: 2
    Last Post: 09-30-2006, 07:18 PM
  3. Countdown script
    By tomleadbetter in forum Flash Scripting
    Replies: 0
    Last Post: 07-28-2006, 12:57 PM
  4. countdown timer
    By ifty40 in forum Flash Scripting
    Replies: 3
    Last Post: 07-25-2005, 04:50 AM
  5. count up in timer?
    By bluereo in forum Flash Scripting
    Replies: 1
    Last Post: 06-17-2005, 07:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial