# Problem with functions

**URL:** https://forum.kirupa.com/t/problem-with-functions/189740
**Category:** Uncategorized
**Created:** [June 5, 2006, 8:48pm UTC](https://forum.kirupa.com/t/problem-with-functions/189740 "2006-06-05T20:48:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pixel1](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@Pixel1](https://forum.kirupa.com/u/Pixel1)
#### Post date: [June 5, 2006, 8:48pm UTC](https://forum.kirupa.com/t/problem-with-functions/189740/1 "2006-06-05T20:48:35Z")

</div>

probleb:  
i want to create a function that can be accessed by  
multiple movieClips at the same time.  
to make things clare (eg):  
//start  
function panFrames(x){  
var frameDir = x;  
this.gotoAndStop(this.\_currentframe+x);

}  
someButton.onRollOut=function(){  
myClip.onEnterFrame=function(){panFrames(-1);}  
}  
//end

## this code fails to work. (Help please…

i also want to create a prototype function  
for the Mc class that can be accessed by any clip  
or 4 clips at the same time (eg):  
//start  
MovieClip.prototype.myProto=function(x){  
this.gotoAndStop(this.\_currentframe+x);  
}  
//end  
and just use  
//start  
someButton.onRollOut=function(){  
myClip.myProtr(-1);  
thereClip.myProto(2);  
ourClip.myProto(-3);  
}  
//end----------------------------------------------------------------  
any help here?  
do i have to create a new instance of the (obj) in every case?
