Prototypes, trying to get individual onEnterFrames on duplicates

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 :slight_smile:

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