Pausing a movie

  • djgetto
  • Born
  • Born
  • djgetto
  • Posts: 1

Post 3+ Months Ago

Hi there.
Ok, so I'm new to Flash and just started using ActionScripts. I'd like to know the code for pausing the playhead for a couple of seconds (say 3) and then continue on with the movie. Any help?

btw. like I said, I'm new to ActionScripts so lamens terms would be appreciated. :lol:
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Sledgehammer
  • Genius
  • User avatar
  • Posts: 13496
  • Loc: Florida

Post 3+ Months Ago

You can use this to pause a movieclip (or root) for "wait" amount of seconds, (defaults to 1 second if "wait" is missing)

Code: [ Select ]
MovieClip.prototype.pause = function(wait){
    var startAfter = wait ? wait*1000 : 1000;
    starter = function(mc){
        clearInterval(starting);
        mc.play();
    }
    this.stop();
    starting = setInterval(starter, startAfter, this);
}
  1. MovieClip.prototype.pause = function(wait){
  2.     var startAfter = wait ? wait*1000 : 1000;
  3.     starter = function(mc){
  4.         clearInterval(starting);
  5.         mc.play();
  6.     }
  7.     this.stop();
  8.     starting = setInterval(starter, startAfter, this);
  9. }

That will go on your main timline, using it with Actionscript will go somthing like this,

(Assuming a button triggers it)
Code: [ Select ]
buttonInstanceName.onRelease = function(){
  _root.pause(3);
}

//OR, on the button itself

on(release){
  this.pause(3);
}
  1. buttonInstanceName.onRelease = function(){
  2.   _root.pause(3);
  3. }
  4. //OR, on the button itself
  5. on(release){
  6.   this.pause(3);
  7. }

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 17 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.