# Mouse Trail But only in a certain part of the movie

**URL:** <https://forum.kirupa.com/t/mouse-trail-but-only-in-a-certain-part-of-the-movie/156507>\
**Category:** flash\
**Created:** [July 26, 2005, 10:43am UTC](https://forum.kirupa.com/t/mouse-trail-but-only-in-a-certain-part-of-the-movie/156507 "2005-07-26T10:43:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibenschop](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@ibenschop](https://forum.kirupa.com/u/ibenschop)\
**Post date:** [July 26, 2005, 10:43am UTC](https://forum.kirupa.com/t/mouse-trail-but-only-in-a-certain-part-of-the-movie/156507/1 "2005-07-26T10:43:35Z")

</div>

Hi guys,

I made a mouse trail effect with the following code.

i=0  
onMouseMove = function () {  
var cur\_x = \_xmouse;  
var cur\_y = \_ymouse;  
var limit = 3;  
var min = 10;  
var max = 60;  
var alfa = 160;  
var delta\_x = old\_x-cur\_x;  
var delta\_y = old\_y-cur\_y;  
var dist = Math.sqrt(delta\_x_delta\_x+delta\_y_delta\_y);  
old\_x = cur\_x;  
old\_y = cur\_y;  
if (dist\>limit) {  
i++;  
attachMovie(“stars”, “stars”+i,-510+i);  
with (this[“stars”+i]) {  
var ran = Math.random()\*max+min;  
var ran2 = Math.random()\*alfa-alfa/2;  
\_rotation = ran2;  
\_xscale = \_yscale=ran;  
\_x = \_parent.\_xmouse;  
\_y = \_parent.\_ymouse;  
}  
}  
};

* * *

Now i saved the movie named stars.swf.

In another movie named main.swf i load the stars.swf in a movie clip container named mc\_ContainerStars.

Ok thinking the stars.swf wil only load itself and work within the container.  
It played itself over the whole main.swf. So i devined the \_height and \_weight of the container. Hoping the mousetrail would only play within these constrains. But it didn’t! It played itself over the whole main.swf.

Any tips suggestions would be nice.

Thanks in advance! Sorry for my english
