Create a movie clip with a hit area shape, reduce it's opacity to 0. Place that
movie clip on the stage with instance name. When someone is dragging an object,
you can use hitTest to determine if it's in the correct spot (at least close
enough) when the mouse is let go. If so, you can assign the object to a defined
x and y coordinate.
Writing a simple snap to grid function is pretty easy, and may work well for
what you need. Essentially, you just test the _xmouse and _ymouse using mod,
if mousePos % snapSetting == 0, then you know you're on a grid point.
This should get you started:
var snapSpace = 10;
var myInterval:Number;
clipA.onPress = function(){
myInterval = setInterval(startDragging, 5, this);
}
clipA.onRelease = clipA.onReleaseOutside = function(){
clearInterval(myInterval);
}
function startDragging(clipRef:MovieClip){
if(_xmouse % snapSpace == 0){
clipRef._x = _xmouse;
}
if(_ymouse % snapSpace == 0){
clipRef._y = _ymouse;
}
}

Signature
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
Shan-Dysigns - 14 Jul 2008 18:58 GMT
I think the question was to snap to other objects (not just a grid of some
kind). Here is an example I made for you. I think it's simple enough for you to
get the idea and figure out how to implement it into your flash. It's nothing
fancy, just fundamental.
Look at my example http://www.shan-dysigns.com/flash/hitTest.fla