Posted By

LANKO on 01/18/08


Tagged

delay movieclip


Versions (?)

delay movieclip (prototype)


 / Published in: ActionScript
 

use it at any place in you movieclip to pause it for a number of frames:

this.delay(10);

  1. MovieClip.prototype.delay=function(f)
  2. {
  3. if(_root.delayCounter==undefined)
  4.  
  5. {
  6. _root.delayCounter=0;
  7. }
  8.  
  9. else
  10. {
  11. _root.delayCounter++;
  12.  
  13. }
  14. this.createEmptyMovieClip("delayTimer"+delayCounter,this.getNextHighestDepth());
  15.  
  16. c=this["delayTimer"+delayCounter];
  17. c.mc=this;
  18. c.f=f;
  19. c._cnt=0;
  20. c.onEnterFrame=function()
  21.  
  22. {
  23. if(this._cnt==this.f)
  24. {
  25.  
  26. this.mc.play();
  27. removeMovieClip(this);
  28. }
  29.  
  30.  
  31. this._cnt++;
  32. }
  33.  
  34. this.stop();
  35.  
  36. }

Report this snippet  

You need to login to post a comment.