# Problem getting a prototype working with dynamic movie clip

**URL:** https://forum.kirupa.com/t/problem-getting-a-prototype-working-with-dynamic-movie-clip/146589
**Category:** Uncategorized
**Created:** [May 2, 2005, 6:44pm UTC](https://forum.kirupa.com/t/problem-getting-a-prototype-working-with-dynamic-movie-clip/146589 "2005-05-02T18:44:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RASMedia](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@RASMedia](https://forum.kirupa.com/u/RASMedia)
#### Post date: [May 2, 2005, 6:44pm UTC](https://forum.kirupa.com/t/problem-getting-a-prototype-working-with-dynamic-movie-clip/146589/1 "2005-05-02T18:44:17Z")

</div>

Hi Everyone, I’m trying to make a random jpeg gallery with images that fade in, remain on screen for 10 seconds, and then fade out. So I’m starting with the fadeIn and I am making it a movieclip prototype. Now, I put a MC named ball\_mc on the stage and gave it an alpha value of 0 to use for testing purposes. The ball\_mc clip calls the prototype fadeIn fine, but the dynamically created movieclip does not. Is it impossible for a dynamically generated movieclip to use a prototype? I’ll post the code below.

Any and all help is appreciated. I’m on a tight deadline!

Code:

MovieClip.prototype.fadeIn = function () {  
this.onEnterFrame = function() {  
if (this.\_alpha\<100) {  
this.\_alpha += 5;  
} else {  
delete this.onEnterFrame;  
}  
};  
};

\_root.createEmptyMovieClip(“container\_mc”, 1000);  
\_root.container\_mc.\_x = 0;  
\_root.container\_mc.\_y = 0;  
loadNewImage = function () {  
var r = (Math.floor(Math.random()\*7)+1).toString();  
container\_mc.\_alpha = 0;  
container\_mc.loadMovie(“pic”+r+".jpg");  
container\_mc.fadeIn();  
}  
setInterval(loadNewImage, 5000);  
ball\_mc.fadeIn();  
stop();
