Ok so I’m making this thing where the line points to where the cursor is and also moves there. Still follow me? I’ll give you teh codes so you can understand what I’m about to explain better.
Symbol 1 (located in scene 1)
[AS]
onClipEvent (enterFrame) {
_x = _x+_xmouse/8;
_y = _y+_ymouse/8;
}
[/AS]
Symbol 2 (located INSIDE Symbol 1)
[AS]
onClipEvent (load) {
this._quality = “LOW”;
}
onClipEvent (enterFrame) {
_rotation = _rotation+((_x ^ _xmouse))/5;
}
[/AS]
That’s teh script for the first one. That will be the “leader”. Right now it’s just a line though. Ok now I want to add more lines that will do the same thing, except instead of following the mouse, theyll follow the mc thats following the mouse instead. Is there any way to make teh code above into that? Please help me!!! lol
noDups = 10; //num of duplicates
for (var j = 1; j<=noDups; j++) {
clip0.duplicateMovieClip("clip"+j, j);
}
//handles clips movements
_root.onEnterFrame = function() {
//this two lines is similar to your clipevent on symbol1
this.clip0._x += (_root._xmouse-this.clip0._x)/8;
this.clip0._y += (_root._ymouse-this.clip0._y)/8;
//handles the movements of the duplicates.. (k-1) means that the clip will inherit the properties the clip prior to it..
for (var k = 1; k<=noDups; k++) {
this["clip"+k]._x += (this["clip"+(k-1)]._x-this["clip"+k]._x)/8;
this["clip"+k]._y += (this["clip"+(k-1)]._y-this["clip"+k]._y)/8;
}
};
…i named your symbol1 as “clip0”. Also remove the onClipEvent on symbol1 since it’s not needed anymore.
btw, the code which i replace your code on your clipevent on symbol1 is “universally formal”. so use and be used to it.
If you want the duplicated mcs to stay behind the original, use this[AS]var noDups = 10, depth = 1000, speed = 8;
clip0.swapDepths(depth);
for (var j = 1; j<=noDups; j++) {
clip0.duplicateMovieClip(“clip”+j, --depth);
}
//handles clips movements
_root.onEnterFrame = function() {
//this two lines is similar to your clipevent on symbol1
this.clip0._x += (_root._xmouse-this.clip0._x)/speed;
this.clip0._y += (_root._ymouse-this.clip0._y)/speed;
//handles the movements of the duplicates… (k-1) means that the clip will inherit the properties the clip prior to it…
for (var k = 1; k<=noDups; k++) {
this[“clip”+k]._x += (this[“clip”+(k-1)]._x-this[“clip”+k]._x)/speed;
this[“clip”+k]._y += (this[“clip”+(k-1)]._y-this[“clip”+k]._y)/speed;
}
};[/AS]
Ok, the only problem now is that the duplicated movie clips point to where the mouse is, not where the leader mc is. Anyway to change that through actionscript so that it changes the rotation code in symbol 2?
here’s the code im currently using for teh rotation