A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Time delay on Movieclip?

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    13

    Time delay on Movieclip?

    For Flash MX.
    How do I go about setting time delays on Movieclips using actionscript? Could somebody point me in the right direction as to what terms to look for or a sample piece of code to look at?
    Thanks.

  2. #2
    Infinite Loop grvdgr's Avatar
    Join Date
    Feb 2001
    Posts
    610
    Hello,

    Stop movie for number of seconds
    Code:
    Frame 1: 
    mydate = new Date(); 
    startSec = mydate.getSeconds(); 
    Frame 2: 
    waited = startSec - nowSec; 
    Frame 3: 
    mydate2 = new Date(); 
    nowSec = mydate2.getSeconds(); 
    if (nowSec == startSec + 10 || nowSec == (60 - startSec)) { 
    trace ("10 seconds up"); 
    stop (); 
    } else { 
    gotoAndPlay (2); 
    }
    Note that frame 2 was just for debugging but you can't go back to frame 1 at any stage because it will reset the start time and your timer will never run down....

    Or

    Drop the following code into the frame you want to pause:

    Code:
    start = getTimer(); 
    while (start+3000>now) { 
    now = getTimer(); 
    }
    This will pause the movie for 3 seconds.

    Hope it helps
    Regards
    ~GD~
    Operator Error

  3. #3
    Junior Member
    Join Date
    Nov 2001
    Posts
    13

    Thanks

    I'll have a snoop at this and give it a try. Thanks for taking the time to answer.

  4. #4
    Junior Member
    Join Date
    Nov 2001
    Posts
    13

    only reads one movieclip

    Hello,
    I used the bottom script you sent but it only plays the time delay on one movie clip. I have a time delay on three seperate clips in the same movie all with different times set. Any ideas how to get around this?
    Thanks

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