# Prototypes, trying to get individual onEnterFrames on duplicates

**URL:** <https://forum.kirupa.com/t/prototypes-trying-to-get-individual-onenterframes-on-duplicates/137769>\
**Category:** Uncategorized\
**Created:** [February 17, 2005, 8:53am UTC](https://forum.kirupa.com/t/prototypes-trying-to-get-individual-onenterframes-on-duplicates/137769 "2005-02-17T08:53:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eilsoe](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@eilsoe](https://forum.kirupa.com/u/eilsoe)\
**Post date:** [February 17, 2005, 8:53am UTC](https://forum.kirupa.com/t/prototypes-trying-to-get-individual-onenterframes-on-duplicates/137769/1 "2005-02-17T08:53:41Z")

</div>

> 

test = function(){  
trace(“//running…”);  
trace(“-----------------”);  
}

MovieClip.prototype.dropMC = function(){  
this.onLoad = function(){  
newX = random(200);  
newY = random(200);  
\_x = newX;  
\_y = newY;  
trace("generated random coordinates: " + newX + “,” + newY);  
}  
}

MovieClip.prototype.move = function(){  
this.onEnterFrame = function(){  
count++;  
if(count\>30){  
targX=random(200);  
targY=random(200);  
count=0;  
}  
\_x+=(targX-\_x)/5;  
\_y+=(targY-\_y)/5;  
}  
}

test.prototype.drawbox = function(){  
i++;  
trace("drawing box: " + i);  
\_root.createEmptyMovieClip(“boxMC”+i,i);  
box = \_root[“boxMC”+i];  
box.lineStyle(1,0x000000,100);  
box.moveTo(0,0);box.lineTo(50,0);box.lineTo(50,50);box.lineto(0,50);box.lineTo(0,0);  
box.type(MovieClip);  
//box.\_x=random(200);  
//box.\_y=random(200);  
\_root[“box”+i].onLoad = \_root.dropMC();  
\_root[“box”+i].onEnterFrame = \_root.move();

}

test.prototype.init = function(){  
//max=100;  
this.drawbox();  
this.drawbox();  
}  
run = new test();  
run.init();

I’m trying to get the individual MC’s created through the prototypes to get a unique load and enterframe settings, (running 2 drawbox functions to create 'em). But they get the same values each :huh:

I’ve JUST gotten into prototypes, so don’t mind the messy code 🙂

(just C&P the code into frame 1 of an empty scene)
