# Need Help with Scripting

**URL:** <https://forum.kirupa.com/t/need-help-with-scripting/28566>\
**Category:** flash\
**Created:** [August 15, 2003, 1:58am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566 "2003-08-15T01:58:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![aussy](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@aussy](https://forum.kirupa.com/u/aussy)\
**Post date:** [August 15, 2003, 1:58am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/1 "2003-08-15T01:58:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:07am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/2 "2003-08-15T03:07:26Z")

</div>

hi aussy!

try placing this code on the main timeline…

```auto

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. 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:33am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/3 "2003-08-15T03:33:11Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:36am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/4 "2003-08-15T03:36:45Z")

</div>

thanks claudz! :thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:47am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/5 "2003-08-15T03:47:17Z")

</div>

welcome noxious  
😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:56pm UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/6 "2003-08-15T15:56:52Z")

</div>

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

:p: aussy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:34pm UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/7 "2003-08-15T16:34:50Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:40pm UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/8 "2003-08-15T16:40:56Z")

</div>

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

[http://www.flashkit.com/movies/Scripting/Other/Sheep-Sasha\_Gu-4367/index.php](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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 3:37am UTC](https://forum.kirupa.com/t/need-help-with-scripting/28566/9 "2003-08-16T03:37:19Z")

</div>

Hi aussy 🙂  
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
