# \[FMX\] Question about prototypes

**URL:** https://forum.kirupa.com/t/fmx-question-about-prototypes/96576
**Category:** Uncategorized
**Created:** [December 11, 2003, 1:34am UTC](https://forum.kirupa.com/t/fmx-question-about-prototypes/96576 "2003-12-11T01:34:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Maizoon](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@Maizoon](https://forum.kirupa.com/u/Maizoon)
#### Post date: [December 11, 2003, 1:34am UTC](https://forum.kirupa.com/t/fmx-question-about-prototypes/96576/1 "2003-12-11T01:34:33Z")

</div>

Hello,

I’m not to keen on prototypes quite yet, but I have this code in frame one of my movie:  
[AS]  
MovieClip.prototype.fadein = function(max, speed) {  
this.onEnterFrame = function() {  
if (this.\_alpha\<max) {  
this.\_alpha += speed;  
} else {  
this.\_alpha = max;  
delete this.onEnterFrame;  
}  
};  
};  
[/AS]

several frames later I have an MC with this code on it:  
[AS]  
onClipEvent(enterFrame){  
this.fadein(100,3);  
}  
[/AS]

I would rather not have the code on the MC, but on the timeline instead. I’ve tried putting this on the main timeline:  
[AS]  
leftBox.fadein(100,3);  
[/AS]  
but it doesn’t do anything, the only way I can get the prototype to actually work is if i put it into an onClipEvent on an MC. Is there something wrong with my prototype thats not letting me call it from the main timeline? Do I have to use clip events on MC’s to make this work?
