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

+ Reply to Thread
Results 1 to 2 of 2
  1. #1

    Default Script activation delay

    hi all, i need a script that fires every 5 seconds, and that in those 5 seconds is not possible to use it, can you help?

    is this:
    onClipEvent (enterFrame) {
    if (Key.isDown(65)) {

    how can I make sure that it is usable every 5 seconds?
    i use flash cs5 as2

    sorry my english

  2. # ADS
    Join Date
  3. #2
    Join Date
    Jun 2009
    Houston, Tx


    You can do this a number of ways. First is by using the getTimer() function. Second, you can find a Timer class that someone has already made and tweak it. Third, you can make your own Timer class using getTimer() or some class, such as the Date class.

    First method is relatively easy and requires few lines of code.
    Second method depends on how good you are at using google. Considering (and only considering) that you are asking for a solution to a timer problem, I assume that google searching is not your strong point.
    Third, this would be relatively hard, considering what was stated above.

    If you want to use the getTimer() function:
    set a variable to getTimer().
    continuously check if getTimer() >= variable + 5000 (getTimer() gives you amount of milliseconds the movie has been playing, so 5000 is equal to 5 seconds with compared to getTimer()).
    if getTimer() >= variable + 5000, then call whatever function, and reset variable to getTimer();

    Now, how you implement this is up to you. Since you are using the enterFame parameter for onClipEvent function, then you can simply turn my words into actual code, and instead of calling a function, just put your if statement inbetween my if statement.

Thread Information

Users Browsing this Thread

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


Tags for this Thread


Posting Permissions

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