A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: pause method?

  1. #1
    Junior Member
    Join Date
    May 2001
    Posts
    15
    Is there a method that will let me pause my movie for a specified anount of time?

    I suppose I can do it with the getTimer() method, just wondering if there is a built in ...
    Thanks...

  2. #2

    Angry

    There are different ways,

    One easy way is to just have some frames in between the movie for that amount of seconds...

    You could also use a control button, The movie stops and a button "play" appears, etc...

    I don't really know why you want to use the gettimer fuction, but I recommend this if it is for simple use...


  3. #3
    Junior Member
    Join Date
    May 2001
    Posts
    15
    Unfortunately, I am not in a situation where I can add blank frames. My movie has to be able to play in different "modes" (it's a flow chart demonstration) according to a text input field. I need a pause method for the timing between sounds and motion tweens. I made the following function:

    function wait(lenght){
    stop();
    var init = getTimer();
    while (getTimer() - init < lenght){}
    play();
    }

    and I call it whenever I want a pause of lenght miliseconds. The problem with this is that an animation symbol placed on the flowchart stops "animating" during the wait() execution.

    Anyone have an Idea?

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    170
    the problem I see is when you are using a while or for loop, flash stops all frames until loop is executed. This means flash stops all timelines.

    I can reccomend to use an empty MC to do this pause, there are many ways to do it. Many times I have used this script/hadler on empty MC:

    onClipEvent (load) {
    delay = ...
    startTime = getTimer ()
    }

    onClipEvent (enterFrame) {
    while (getTimer - startTime < delay){
    break
    _root.play()
    }
    }

    and just now you can put this empty MC to frame where you need to have a pause


    Alex

  5. #5
    Junior Member
    Join Date
    May 2001
    Posts
    15
    Thanks for the reply metaminds!

    I understand the onClipEvent(load) part.

    onClipEvent (load) {
    delay = ...
    startTime = getTimer ()
    }


    In the second onClipEvent, however, won't the break stop the _root.play() from ever playing since it is placed before?

    onClipEvent (enterFrame) {
    while (getTimer - startTime < delay){
    break
    _root.play()
    }
    }

    I can't seem to make this work. Here's what I understand:

    1. onClipEvent(load) ... initialisations ->ok
    2. onClipEvent(enterFrame) --------------->ok
    3. while( .... ) ------------------------->ok
    4. break ....... why get out of the loop?
    5. _root.play() ... from where will this make my movie play?
    . how will it repeat the empty MC?

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