A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Pause timeline

  1. #1
    Junior Member
    Join Date
    Apr 2003
    Posts
    27

    Pause timeline

    Timeline Pause(s)
    HI!

    I know how to insert a pause in one MC timeline. But in my animation i need to do a lot of pauses and, most important, in diferents MC.
    i've used this code on _root:

    function pause() {
    _root.arranque.aproximar.play();
    clearInterval(_root.arranque.aproximar.timer);
    }

    And this on the MC's frame wich i want to pause:

    timer = setInterval(_root.pause, 2500);

    It works fine but i need to pause another timelines. Can anyone help me?

    Thanks a Lot


    HUGO ANDRÉ RIBEIRO

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    The function you have labeled "pause" looks like an unpause to me (it calls play, not stop).

    Is that correct?

    Anyway, to use your function with another movieclip, you can make it part of the movieclip protoype, and then use the other version of setInterval, like so:

    Code:
    // This is your "pause" function.
    // I renamed it.
    Movieclip.prototype.unpause() 
    {
      this.play();
      clearInterval( this.pauseTimer );
    }
    
    // This stops the clip and sets it up...
    Movieclip.prototype.pauseForABit(abit)
    {
      this.stop();
      this.pauseTimer = setInterval(this, "unpause", abit);
    }
    
    // To pause a movie clip for a bit, such 
    // as 2500 milliseconds, use this:
    
    anyMovieclipYouLike.pauseForABit(2500);
    - Jim

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