Time delayed script
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Time delayed script

  1. #1
    Member
    Join Date
    Nov 2000
    Posts
    92
    I want to put a time delay into my animation. so when the playhead gets to say frame 10, it waits 5 second and carries out a another instruction or loops the animation again or whatever. I'm just interested in adding the delay in seconds to my scripts. How?

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    185
    http://www.actionscripts.org/tutoria...ts/index.shtml

    (I find this a bit confusing, if anyone has a easier solution, please post it)

  3. #3
    Member
    Join Date
    Nov 2000
    Posts
    92
    Thanks I'll try that.

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Posts
    185
    Originally posted by Aelo
    I think this is much simpler...

    first frame of animation>>
    Code:
    var startTime = getTimer();
    var countAmount = 5;
    var elapsed = 0;
    Code:
    
    
    I think something is missing here...

  5. #5
    Member
    Join Date
    Nov 2000
    Posts
    92
    I think this is much simpler...

    first frame of animation timeline>>
    Code:
    var startTime = getTimer();
    var countAmount = 5;
    var elapsed = 0;
    last frame of animation timeline>>
    Code:
    elapsed = getTimer() -starTime;
    if (elapsed > countAmount *1000) {
    gotoAndPlay(1);
    } else {
    stop();
    }
    It's not working though. What am I missing?

  6. #6
    Member
    Join Date
    Nov 2000
    Posts
    92
    Someone please help. If the aniimation is 30 frames, I have the top script in frame 1 and the second script in frame 30 in seperate scripts layer. What am I missing with regard to it holding for 30 seconds and then proceeding to loop again?

  7. #7
    [title goes here]
    Join Date
    Apr 2002
    Location
    usa
    Posts
    124
    your 'if' statement only checks once
    so if elapsed is not > 5000 on the first check
    then it just stops

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com