# Prototype Help

**URL:** <https://forum.kirupa.com/t/prototype-help/12144>\
**Category:** flash\
**Created:** [January 27, 2003, 4:16pm UTC](https://forum.kirupa.com/t/prototype-help/12144 "2003-01-27T16:16:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrthad](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@andrthad](https://forum.kirupa.com/u/andrthad)\
**Post date:** [January 27, 2003, 4:16pm UTC](https://forum.kirupa.com/t/prototype-help/12144/1 "2003-01-27T16:16:45Z")

</div>

Hi all,

Working on a flash component and I am having trouble referencing prototype functions. All of this code is in the 1st frame of my component. For example, in the performBuffer prototype I am trying to call the muteSong prototype and the stopBuffer prototype, but I am not having any luck. Any help is appreciated. I can send more of the code if needed.

```auto

function JukeBoxClass() {
	this.init();
}

JukeBoxClass.prototype = new MovieClip();

JukeBoxClass.prototype.init = function() {
   some code
}

JukeBoxClass.prototype.muteSong = function() {
     code to mute song
}

JukeBoxClass.prototype.performBuffer = function() {
     this.muteSong();
     //Check to see if Ten Second Buffer Exists
     if(mySong.duration - (10 * 1000) >= mutePosition){
           this.stopBuffer();
}

JukeBoxClass.prototype.stopBuffer = function() {
     code to stop buffer here
}

JukeBoxClass.prototype.onEnterFrame = function(){
       	if ((mySong.position == mySong.duration) && (mySong.position > 1000) && (percentLoaded != 100)){
	callBuffer = setInterval(this.performBuffer, 100);
	}

}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 27, 2003, 6:54pm UTC](https://forum.kirupa.com/t/prototype-help/12144/2 "2003-01-27T18:54:30Z")

</div>

did you initclip and register class?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 27, 2003, 6:59pm UTC](https://forum.kirupa.com/t/prototype-help/12144/3 "2003-01-27T18:59:47Z")

</div>

Hi Sen,

Thanks for your help. I sure did. At the top I have

```auto

#initclip

```

and then at the bottom I have

```auto

Object.registerClass("JukeBox", JukeBoxClass);
#endinitclip

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 27, 2003, 9:29pm UTC](https://forum.kirupa.com/t/prototype-help/12144/4 "2003-01-27T21:29:43Z")

</div>

I guess my main question is just how do you call a prototype function from another prototype function. I always thought it was just this.functionName();. As long as it is in the same class in the same frame of a movieclip. Anybody have some comments.

```auto

JukeBoxClass.prototype.muteSong = function() {
    this.doStuff();
}

JukeBoxClass.prototype.doStuff = function() {
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 28, 2003, 12:39am UTC](https://forum.kirupa.com/t/prototype-help/12144/5 "2003-01-28T00:39:00Z")

</div>

yeah thats pretty much it. I think your problem lies in the setInterval though. If you are applying the interval to an object and one of its methods, use the form  
**setInterval(object, “method”, time)**

callBuffer = setInterval(this, “performBuffer”, 100);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 28, 2003, 2:25pm UTC](https://forum.kirupa.com/t/prototype-help/12144/6 "2003-01-28T14:25:26Z")

</div>

Thanks Sen. I will check it out tonight.
