# Attaching something to mouse

**URL:** https://forum.kirupa.com/t/attaching-something-to-mouse/183698
**Category:** Uncategorized
**Created:** [March 29, 2006, 9:59am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698 "2006-03-29T09:59:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![matt3](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/matt3/32/2096_2.png) [@matt3](https://forum.kirupa.com/u/matt3)
#### Post date: [March 29, 2006, 9:59am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698/1 "2006-03-29T09:59:43Z")

</div>

Creating a banner to promote an event.

They have a duck hunt style game already created.

I thought it would be quite cool to have a crosshair as the cursor on the banner and to when you click it (shoot) the duck some other movieclip plays with more details on the event.

Only I don’t really know where to start, I’m not certain of the terminology I need to search for, presuming its something like attach\_mc.mouse or something like that but kinda fumbling round in the dark.

Once I have that part of the code I think I can pretty much handle the rest, with either a hit test or a simple onRelease (as the duck pretty much covers the entire 300x300 banner) so I can load in the next movie click once its clicked.

Its just these changing the mouse pointer to a crosshair I’m struggling with!!

Thanks in advance

Matt

---

<div class="post-metadata">

### Author: ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)
#### Post date: [March 29, 2006, 10:01am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698/2 "2006-03-29T10:01:49Z")

</div>

on frame

```auto
onEnterFrame=function(){
mc._x = _xmouse;
mc._y = _ymouse;
};

```

---

<div class="post-metadata">

### Author: ![matt3](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/matt3/32/2096_2.png) [@matt3](https://forum.kirupa.com/u/matt3)
#### Post date: [March 29, 2006, 10:16am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698/3 "2006-03-29T10:16:21Z")

</div>

> [@nathan99](#):
>
> on frame ActionScript Code:  
> [FONT=Courier New][LEFT][COLOR=#0000FF]onEnterFrame[/COLOR]=[COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
> mc.[COLOR=#0000FF]\_x[/COLOR] = [COLOR=#0000FF]\_xmouse[/COLOR];  
> mc.[COLOR=#0000FF]\_y[/COLOR] = [COLOR=#0000FF]\_ymouse[/COLOR];  
> [COLOR=#000000]}[/COLOR];  
> [/LEFT]  
> [/FONT]

Hehe nifty 🙂

thanks v much figured it’d be something simple like that.

I’ve hidden the mouse now using Mouse.hide(); one thing I did notice is that swapping the pointer with the movie clip whilst the Mouse pointer was still showing, it actually attached the movieclip on the tip of the mouse pointer (the movie clip was just a quick square I built).

Its not going to be a big deal I guess as my target area is going to cover pretty much the entire banner anyway. But for future reference, does this make any difference if you wanted to build an accurate targetting system?

Can you ‘centre’ your movie clip over the cursor position??

Just curious more than anything as I assume this is how they do it for FPS games.

Thanks again for the response a whole new world of interactivity has opened!! 😃

---

<div class="post-metadata">

### Author: ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)
#### Post date: [March 29, 2006, 10:18am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698/4 "2006-03-29T10:18:39Z")

</div>

It actually attaches the registration point(see the alignment) to the mouse

---

<div class="post-metadata">

### Author: ![matt3](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/matt3/32/2096_2.png) [@matt3](https://forum.kirupa.com/u/matt3)
#### Post date: [March 29, 2006, 10:26am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698/5 "2006-03-29T10:26:47Z")

</div>

Ahh you know the minute I hit ‘post’ I thought it may do hehe

Many thanks again for the prompt responses!

---

<div class="post-metadata">

### Author: ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)
#### Post date: [March 29, 2006, 10:42am UTC](https://forum.kirupa.com/t/attaching-something-to-mouse/183698/6 "2006-03-29T10:42:56Z")

</div>

:dog:
