# MC Mouse Movement over an MC

**URL:** <https://forum.kirupa.com/t/mc-mouse-movement-over-an-mc/288267>\
**Category:** flash\
**Created:** [May 13, 2009, 3:45pm UTC](https://forum.kirupa.com/t/mc-mouse-movement-over-an-mc/288267 "2009-05-13T15:45:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cr\_sa](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@cr\_sa](https://forum.kirupa.com/u/cr_sa)\
**Post date:** [May 13, 2009, 3:45pm UTC](https://forum.kirupa.com/t/mc-mouse-movement-over-an-mc/288267/1 "2009-05-13T15:45:10Z")

</div>

On working with this Snow Tutorial, is a hitTest the only way to control mouse movement only over the movieclip and not the entire swf that the snow\_mc is placed in?

```auto

onClipEvent (load) {
    //variables
    width = 300;
    height = 200;
    //random x,y, and alpha 
    this._xscale = this._yscale=50+Math.random()*100;
    this._alpha = 20+Math.random()*50;
    //random x and y for flakes
    this._x = -width+Math.random()*(3*width);
    this._y = -10+Math.random()*height;
    //speed and trigonometric value
    i = 1+Math.random()*2;
    k = -Math.PI+Math.random()*Math.PI;
    rad = 0;
}
onClipEvent (enterFrame) {
    // horizontal movement
    rad += (k/180)*Math.PI;
    xmovement = _root._xmouse;
    this._x -= Math.cos(rad)+(xmovement-(width/2))/50;
    // vertical movement
    this._y += i;
    // remove clips when they misbehave (overstep boundaries)
    if (this._x>(width+50)) {
        this._x = -45;
        this._y = Math.random()*height*2;
    }
    if (this._x<-50) {
        this._x = width+45;
        this._y = Math.random()*height*2;
    }
    if (this._y>=height) {
        this._y = -50;
        this._x = -width+Math.random()*(3*width);
    }
}

```

**-------------hitTest---------------**

```auto

[COLOR=Black][COLOR=#b1b100]if[/COLOR] [COLOR=#66cc66]([/COLOR][COLOR=#0066cc]this[/COLOR].[COLOR=#0066cc]hitTest[/COLOR][COLOR=#66cc66]([/COLOR][COLOR=#0066cc]_root[/COLOR].[COLOR=#0066cc]_xmouse[/COLOR], [COLOR=#0066cc]_root[/COLOR].[COLOR=#0066cc]_ymouse[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#66cc66])[/COLOR][COLOR=#66cc66])[/COLOR] [COLOR=#66cc66]{[/COLOR]
  ...
[COLOR=#66cc66]}[/COLOR] [COLOR=#b1b100]else[/COLOR] [COLOR=#66cc66]{[/COLOR]
  [COLOR=#b1b100]if[/COLOR] [COLOR=#66cc66]([/COLOR][COLOR=#0066cc]this[/COLOR].[COLOR=#0066cc]_y[/COLOR] < [COLOR=#cc66cc]0[/COLOR][COLOR=#66cc66])[/COLOR] [COLOR=#66cc66]{[/COLOR]
    [COLOR=#0066cc]this[/COLOR].[COLOR=#0066cc]_y[/COLOR] += speed;[/COLOR]
  [COLOR=#66cc66]}[/COLOR]
[COLOR=#66cc66]}[/COLOR]

```
