# Confining startDrag to x axis

**URL:** <https://forum.kirupa.com/t/confining-startdrag-to-x-axis/163083>\
**Category:** flash\
**Created:** [September 19, 2005, 5:22pm UTC](https://forum.kirupa.com/t/confining-startdrag-to-x-axis/163083 "2005-09-19T17:22:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben\_is\_sparky](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ben_is_sparky/32/664_2.png) [@ben\_is\_sparky](https://forum.kirupa.com/u/ben_is_sparky)\
**Post date:** [September 19, 2005, 5:22pm UTC](https://forum.kirupa.com/t/confining-startdrag-to-x-axis/163083/1 "2005-09-19T17:22:32Z")

</div>

I was looking at this tute:  
[http://www.kirupa.com/developer/flash5/follow.htm](http://www.kirupa.com/developer/flash5/follow.htm)

How would I constrain it to the x axis?  
Also, how can I put a maximum and minimum \_x value on it, that it wil always stay between?  
[size=1]  
I’m sure I know this already, just can’t remember…

[size=2]Edit: nevermind, looked in the flash help and you just need a couple more parameters.

Edit2: Ok, new question, I have this code, to make a little bar follow the mouse behind the menu, it works ok, but I can’t click the buttons anymore, and the rollOut doesn’t seem to work. Any ideas?

```auto
leftConstraint = 60
topConstraint = 0
rightConstraint = 420 
bottomConstraint = 0

this.onRollOver = function () {
	this.navBarBlocks.startDrag(true,leftConstraint,topConstraint,rightConstraint,bottomConstraint);
};

this.onRollOut = function () {
	this.navBarBlocks.stopDrag();
};

```

[/size] [/size]
