How to determine draging area?

This prolly a silly question, but how do you guys determine the drag parameters when setting up a dragable item in flash mx? Not sure if im using correct terminolgy but what if refering to is the ’ constrain to rectangle ’ and ’ lock to center parameters ’ on the startDrag cmd. Right now I am just plugging in numbers until I get the results I want – must be a better way :).


Constrain to rectangle constrains to a rectangle, it won’t let you drag outside that area.
Lock to center locks the drag to center. The mouse is at the center of the clip.

pom :smirk:

Thanks for the reply Pom! What I meant is whats the best way to figure out the cordinates to use for these values.

Say with this scenerio. My main MC is 400x400 and I am importing a external MC thats 100x100. Well I like to set it up so you can drag the external MC but not outside the boundaries of the main MC. Ok, Im familiar with the ‘Constrain to rectangle’ function but not really sure on how to figure an easy way of coming up with the cordinates to use. Hope that makes sense.


Well, you’d have to calculate the boudaries of the big clip, and make so that the small clip cannot get out.

An example: put a big square on your scene, movie clip, and instance name big. Then a small square, instance name small.

Then put this code in the first frame of the main movie:

// calculates edges of BIG

// calculates real top, left... so that small remains in big


Post if you have problems with the code.

pom :cowboy: