# Global functions

**URL:** <https://forum.kirupa.com/t/global-functions/223647>\
**Category:** Uncategorized\
**Created:** [April 24, 2007, 4:48pm UTC](https://forum.kirupa.com/t/global-functions/223647 "2007-04-24T16:48:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grenouille](https://avatars.discourse-cdn.com/v4/letter/g/f6c823/32.png) [@grenouille](https://forum.kirupa.com/u/grenouille)\
**Post date:** [April 24, 2007, 4:48pm UTC](https://forum.kirupa.com/t/global-functions/223647/1 "2007-04-24T16:48:29Z")

</div>

Hi,

I found this handy little function to pause the timeline

```auto

function paused(sec) {
   stop(); // action to pause
   var i = sec - 1;
   var t = setInterval(function () {
      if (i == 0) {
         clearInterval(t);
         play(); // action to continue
      }
      i--;
   }, 1000);
}

```

I need this function in several different frames in the timeline. How can I make this a ‘global’ function, so I only have to write it once and can use it wherever I want?  
I did some googling and thought I could use the prototype thing, but I guess this is only for Movieclip functions?

Thnx in advance,

Grenouille.
