HI. What is the above code for? I am trying to do something where I have a bunch of polka dots on the screen and the user can drag them around to form designs. However, I am not sure if I should use duplicate movie clip, plus I am having probs individually dragging them. I tried putting each dot on individual layers but that doesn’t seem to work. Any sggestions on how to create many individual instances of one movie clip that are individually draggable?
I also have them color coded, for instance on the left side I have color samples so you canc hange the color of the dots. That is why the dots are instances and not separate, so I don’t have to Set RGB for every single one of them.
I would appreciate a response, if you ever look at this post.
to affect each dot, you should make a prototype and assign it to each dot that you duplicate… like this:
[AS]numDots = 10;
scrnW = 300;
scrnH = 200;
MovieClip.prototype.drag = function() {
this.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse, true)) {
this.startDrag();
}
this.onMouseUp = function() {
this.stopDrag();
};
};
};
for (i=1; i<=numDots; i++) {
dot = “dot”+i;
_root.attachMovie(“dotID”, dot, i);
_root[dot]._x = Math.random()*scrnW;
_root[dot]._y = Math.random()*scrnH;
_root[dot].drag();
}[/AS]
Can I do the prototype function in Flash 5? I tried it and it shows no error but it doesn’t work either. Hm. So I’m making a dot, and duplicating it with control-D and then putting the script on each dot? Is the “numDot” supposed to physically exist or is it just for the “for” statement? WHy is it that I have to have the “numDot” rather than just using “dot?”