A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Time delay

  1. #1
    Member
    Join Date
    Jun 2003
    Posts
    34

    Time delay

    Hey
    I would like to know how would i add a time delay to a onEnterFrame script.

    thanks,
    daniel.

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    you could do a simple count down based on your frame rate.

    If your frame rate is 30fps then 60 frames is 2 seconds for example.

    code:

    //if your putting all the code on the movie clip
    onClipEvent(load){
    countDown = 60;
    }
    onClipEvent(enterFrame){
    if(countDown > 0){
    countDown--;
    }else{
    //what to do after timer
    }
    }



    times are approximate due to differences in users processor speed so you can't set your watch by it or anything.

  3. #3
    Senior Member
    Join Date
    Feb 2001
    Location
    On the fifth floor.
    Posts
    1,202
    Code:
    timeDelay = 3000//in milliseconds 
    mc.onLoad = function(){
    	tt = getTimer();
    }
    mc.onEnterFrame = function(){
    	if((getTimer()-tt)>timeDelay){
    		//what to do after time delay
    	}
    }

  4. #4
    Member
    Join Date
    Apr 2005
    Location
    Dubai, UAE
    Posts
    57
    I've 5 MovieClips ...
    Should I use your code repeatedly sergwiz ?
    Last edited by Mr.FlashKit; 07-06-2006 at 04:39 AM.
    Mr.FlashKit

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    what exactly are u trying to do?
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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