# Custom Cursor W/ Fixed Y Coordinate

**URL:** https://forum.kirupa.com/t/custom-cursor-w-fixed-y-coordinate/186008
**Category:** flash
**Created:** [April 18, 2006, 12:51pm UTC](https://forum.kirupa.com/t/custom-cursor-w-fixed-y-coordinate/186008 "2006-04-18T12:51:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MattyG](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mattyg/32/868_2.png) [@MattyG](https://forum.kirupa.com/u/MattyG)
#### Post date: [April 18, 2006, 12:51pm UTC](https://forum.kirupa.com/t/custom-cursor-w-fixed-y-coordinate/186008/1 "2006-04-18T12:51:06Z")

</div>

This probably is a no brainer…

I am hiding the cursor and draging a movie clip after clicking on a button.

How would I make this movie clip move along the x axis only?

```auto

function loadCoin() {
    Mouse.hide();
    startDrag("loadedCoin", true);
}

```

---

<div class="post-metadata">

### Author: ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.kirupa.com/u/claudio)
#### Post date: [April 18, 2006, 12:58pm UTC](https://forum.kirupa.com/t/custom-cursor-w-fixed-y-coordinate/186008/2 "2006-04-18T12:58:04Z")

</div>

```auto
function loadCoin() {
    Mouse.hide();
    onMouseMove = function(){
		loadedcoin._x = _xmouse;
		updateAfterEvent();
	}
}

```

---

<div class="post-metadata">

### Author: ![MattyG](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mattyg/32/868_2.png) [@MattyG](https://forum.kirupa.com/u/MattyG)
#### Post date: [April 18, 2006, 8:15pm UTC](https://forum.kirupa.com/t/custom-cursor-w-fixed-y-coordinate/186008/3 "2006-04-18T20:15:41Z")

</div>

> [@claudio](#):
>
> ```
> ActionScript Code:
> [FONT=Courier New][LEFT][COLOR=#000000] **function** [/COLOR] loadCoin[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
> [COLOR=#0000FF]Mouse[/COLOR].[COLOR=#0000FF]hide[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
> [COLOR=#0000FF]onMouseMove[/COLOR] = [COLOR=#000000] **function** [/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
> 
> ```
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loadedcoin.[COLOR=#0000FF]\_x[/COLOR] = [COLOR=#0000FF]\_xmouse[/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;updateAfterEventCOLOR=#000000[/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;[COLOR=#000000]}[/COLOR]  
> [COLOR=#000000]}[/COLOR]  
> [/LEFT]  
> [/FONT]

This did the trick! :hugegrin:

One more question. Say I want to click on a button. On release I’d like the object attached to my mouse to get dropped off right where I click. So it wouldn’t follow the mouse after the button is clicked.

Any suggestion on how to accomplish this?

Thanks

---

<div class="post-metadata">

### Author: ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.kirupa.com/u/claudio)
#### Post date: [April 19, 2006, 3:07am UTC](https://forum.kirupa.com/t/custom-cursor-w-fixed-y-coordinate/186008/4 "2006-04-19T03:07:42Z")

</div>

```auto
function loadCoin() {
    Mouse.hide();
    onMouseMove = function(){
        loadedcoin._x = _xmouse;
        updateAfterEvent();
    }
}
function unloadCoin() {
    Mouse.show();
    delete onMouseMove;
}
button.onPress = unloadCoin;

```
