[FlashMX] x,y position for startDrag

my new problem. I have a graphic which represents a knob which will be pulled to open a new window. I’m using drag 'n drop for this. However i need to restrict the knob so that it doesn’t get dragged around the page, but is restricted to movement in one direction only.------------> like a knob being pulled.
This is the code so far.

pullmc.onPress =function() {
//these numbers are wrong
pullmc.onRelease = function() {
my problem is that i don’t know how to get the correct values for inside those parenthesis. i know it’s left, top, right, bottom. the property inspector only gives x,y. how does this relate to top,right, bottom? This is probably a really stupid question. but I can’t figure it out…
thanks for any help.

Im not sure what you mean, do you mean this…

[AS]target.startDrag(lockcenter, left, top, right, bottom);[/AS]

Where target is the target movie clip.

lockcenter is a boolean value (true or false) whether to lock the mouse to the center of the clip or not

left is how far left

top is how far up

right is how far right

bottom is how far down

yes exactly, that’s what i mean. but how do you get those figures for a movie clip sitting on the stage?

It is just coordinates.

how far left is the final _x coordinate you want your clip be to able to move to the left. So if you set that to 100 then you will not be able to drag your clip to less than 100 pixels.

So if you set

left to 100

right to 200

top to 100

bottom to 200

You will have a nice little 100x100 square constrained area. The upper left corner will be at (100, 100) and the lower right corner will be at (200, 200)

you can use the info panel and move your mouse around on the screen to see where the coordinates are for x and y in that position. You can then use those (moving your mouse to the right spot to get the coordinates) in your start drag. Either that or physically move the movieclip it self to the right extents and use its own _x and _y in those locations to work for the constrain

PS, since you’re in the Flash MX forum, you dont have to specify MX in the title :wink: thats only for the Actionscript forum :beam:

thanks senocular that really helped