Need Help with Scripting

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

Thanks
:p: aussy

hi aussy!

try placing this code on the main timeline…


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. :wink:

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]

thanks claudz! :thumb:

welcome noxious
:wink:

Thanks claudio, youre finally on. Darn moderators called my footer “too intensive” lol. oh well

:p: aussy

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

[AS]
onClipEvent (load) {
this._quality = “LOW”;
}
onClipEvent (enterFrame) {
_rotation = _rotation+((_x ^ _xmouse))/5;
}
[/AS]

Hopefully someone will help :sigh:

:p: aussy

p.s. lol what a coincidence, just as im making a new footer, they ban my other one :stuck_out_tongue:

Nvm, it looks fine. ANyway I can make something like this?

http://www.flashkit.com/movies/Scripting/Other/Sheep-Sasha_Gu-4367/index.php

That’s what inspired me to make my new footer. Anyway thanks a lot guys. When are you on msn claudio? I never catch you when youre online.

:p: aussy

Hi aussy :slight_smile:
Im not having the time to go online on msn lately… lots of things to do :hangover:
Hope next week i have some spare time…

Cheers