# Mouse trailer Battle

**URL:** <https://forum.kirupa.com/t/mouse-trailer-battle/23250>\
**Category:** design\
**Created:** [June 15, 2003, 10:00am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250 "2003-06-15T10:00:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)\
**Post date:** [June 15, 2003, 10:00am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/1 "2003-06-15T10:00:33Z")

</div>

Hi,

Would anyone be interested is a little Actionscript battle? I was thinking about mouse trailers because they are easy to make and you can get some really nice effects.

Tweens would be allowed, but no imported graphics or things like that…

If some of you are interested but need a script to get started, I (or anyone else) can provide a quick tute on mouse trailers.

I hope some of the mods will be interested too, I know we have a few masters… (Dan, Thor :bad: )

Cheers.  
pom :love:

---

<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:** [June 15, 2003, 11:50pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/2 "2003-06-15T23:50:46Z")

</div>

I might, I am just begining to venture in the world of AS, but I wouldnt mind trying! As script tut might be nice!

---

<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:** [June 16, 2003, 12:06am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/3 "2003-06-16T00:06:59Z")

</div>

I might be up for that

---

<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:** [June 16, 2003, 1:27am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/4 "2003-06-16T01:27:27Z")

</div>

count me in

---

<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:** [June 16, 2003, 8:23pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/5 "2003-06-16T20:23:40Z")

</div>

great idea ilyas, im in

---

<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:** [June 16, 2003, 11:25pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/6 "2003-06-16T23:25:39Z")

</div>

I’m an actionscript noob, but I’ll give it a shot. (my first contest:))

---

<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:** [June 17, 2003, 4:19pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/7 "2003-06-17T16:19:23Z")

</div>

Let’s roll then =)

---

<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:** [June 17, 2003, 8:45pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/8 "2003-06-17T20:45:48Z")

</div>

so am i allowed in this? 😊

---

<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:** [June 18, 2003, 6:26am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/9 "2003-06-18T06:26:50Z")

</div>

when is the deadline?

---

<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:** [June 18, 2003, 10:41am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/10 "2003-06-18T10:41:03Z")

</div>

Thor \>\> :bad:  
sushis \>\> Check this thread 🙂 [http://www.kirupaforum.com/forums/showthread.php?s=&postid=223855#post223855](http://www.kirupaforum.com/forums/showthread.php?s=&postid=223855#post223855)

---

<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:** [June 18, 2003, 11:03am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/11 "2003-06-18T11:03:16Z")

</div>

> If some of you are interested but need a script to get started, I (or anyone else) can provide a quick tute on mouse trailers.

Can anyone do this please?

---

<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:** [June 18, 2003, 11:46am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/12 "2003-06-18T11:46:43Z")

</div>

I’ve never taken part in a battle before, but here goes!

PS. That means “yes”

---

<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:** [June 18, 2003, 12:49pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/13 "2003-06-18T12:49:24Z")

</div>

> \*Originally posted by RussianBeer \*  
> \*\*Can anyone do this please? \*\*  
> Hum, err… Let me work on that.

---

<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:** [June 20, 2003, 11:24am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/14 "2003-06-20T11:24:10Z")

</div>

Can we import grafix and trace bitmap?

---

<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:** [June 20, 2003, 11:49am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/15 "2003-06-20T11:49:19Z")

</div>

Nope, nothing external 🙂

RussianBeer \>\> The basis: Let’s say you have a clip in your library with the linkage name “theClip”. First step:

```auto
this.onEnterFrame = function(){
i++;
var mc = this.attachMovie("theClip","theClip"+i,i);
mc._x = _xmouse;
mc._y = _ymouse;
}

```

You attach a clip at the position of the mouse onEnterFrame.

---

<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:** [June 20, 2003, 11:53am UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/16 "2003-06-20T11:53:31Z")

</div>

Next step: we add an enterFrame to the created clips

```auto
function fadeOut(){
this._alpha -= 5;
if (this._alpha < 10){
this.removeMovieClip();
}
}
this.onEnterFrame = function(){
i++;
var mc = this.attachMovie("theClip","theClip"+i,i);
mc._x = _xmouse;
mc._y = _ymouse;
mc.onEnterFrame = fadeOut;
}

```

You can do pretty much anything you want in that function.  
The next step would be attaching the clip at another position that the mouse position, making the clips react to each other…

---

<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:** [June 20, 2003, 12:53pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/17 "2003-06-20T12:53:40Z")

</div>

mmhhh. Doesnt that make the CPU blow up?, looks like the loop could be repeated billions of of times…

---

<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:** [June 20, 2003, 1:00pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/18 "2003-06-20T13:00:24Z")

</div>

because the clip’s enterFrame is fadeout, it will end up removing itself after a couple of frames and you wont have to worry about it clogging up the system - clips get removed at the same rate they are added so you get an equilibrium 🙂

---

<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:** [June 20, 2003, 4:37pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/19 "2003-06-20T16:37:56Z")

</div>

The first code I posted WILL blow your computer out, though :beam:

---

<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:** [June 20, 2003, 5:40pm UTC](https://forum.kirupa.com/t/mouse-trailer-battle/23250/20 "2003-06-20T17:40:12Z")

</div>

who needs to keep duplicating movieclips when you can have a set amount with the ilusion of fading… try this:  
[AS]numMCs = 100; //the number of movie clips that will trail  
speed = 1.1; //the speed at which the movie clips will follow the mouse  
for (i=1; i\<=numMCs; ++i) { //starts a for loop  
MC = “MC”+i; //MC is a variable that stores the names of all the new movie clips  
//MC is updated every loop  
\_root.attachMovie(“MCID”, MC, i); //attaches a movie clip from the library with the linkage name “MCID”  
\_root[MC].\_alpha = (100/numMCs)\*(numMCs-i+1); //adjusts each MC’s alpha. if you’re going to use 100 MC’s the  
//just use 'MC.\_alpha = 100-(i+1). the original code spreads out  
//alpha throughout the MC no matter how many you have  
} //ends the for loop  
onEnterFrame = function () { //starts an onEnterFrame function  
for (i=1; i\<=numMCs; ++i) { //starts a for loop  
MC = “MC”+i; //stores the names of all the new movie clips  
if (i == 1) { //checks if i is equal to 1  
\_root[MC].\_x = \_xmouse; //if i = 1 then the loop is on the first loop and on the first MC  
\_root[MC].\_y = \_ymouse; //this means the first MC has to follow the mouse  
} else { //if the above if statement is not satisfied, then do the following actions  
MCb = “MC”+(i-1); //MCb stores the name of the MC that’s ahead of it  
\_root[MC].\_x -= (\_root[MC].\_x-\_root[MCb].\_x)/speed; //the current MC eases towards the MC that’s  
\_root[MC].\_y -= (\_root[MC].\_y-\_root[MCb].\_y)/speed; //ahead of it  
} //closes the if statement  
} //declares the end of the for loop  
}; //declares the end of the onEnterFrame function[/AS]

[Next page](https://forum.kirupa.com/t/mouse-trailer-battle/23250.md?page=2)
