# Prototype not working directly calling in a function

**URL:** <https://forum.kirupa.com/t/prototype-not-working-directly-calling-in-a-function/189794>\
**Category:** Uncategorized\
**Created:** [June 6, 2006, 10:43am UTC](https://forum.kirupa.com/t/prototype-not-working-directly-calling-in-a-function/189794 "2006-06-06T10:43:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NovemberRain](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@NovemberRain](https://forum.kirupa.com/u/NovemberRain)\
**Post date:** [June 6, 2006, 10:43am UTC](https://forum.kirupa.com/t/prototype-not-working-directly-calling-in-a-function/189794/1 "2006-06-06T10:43:47Z")

</div>

I’ve a strange problem. I defined a movieclip prototype for tweening.

```auto
MovieClip.prototype.tweening = function(destination) {
 this.destinationX = destination;
 this.onEnterFrame = function() {
  var distance = this.destinationX-this._x;
  this._x += distance/5;
 };
};

```

Two arrays for clips location and clips

```auto

defaultLocation = [252.8, 338.5, 400.6, 454.8, 539.5];
left01Clips = [clip_01, clip_02, clip_03, clip_04, clip_05]; 

```

I defined another function to restore the location of the clips and call the function.

```auto
function restoreLocation (){
 for ( i=0; i<left01Clips.length; i++ ) {
  left01Clips*.tweening(defaultLocation*);
 }
}
 
restoreLocation () //It's not working. 
 

```

But we call this function using a button some thing like this it’s working. what is going wrong with this.

myButton.onRelease = function () {  
restoreLocation () ;  
}
