Snapping rectangles with ALL corners?

ello.

I’m creating a little 2D interface for a ‘modular furniture system’ I designed for school (I study architecture). It consists of several different rectangles that can be dragged anywhere on stage and can be placed randomly on/next to each other. I’ve been searching for a while now, and I can’t seem to find an answer tot my little problem. So here I go:
Say, I have two draggable, simple rectangles, but different in shape and size, both movieclips. Is there a way to make them snap on each other on ALL corners of both the rectangles? So say I’m dragging rectangle1, it has tot snap with it’s upper-left corner all corners of rectangle2, but also with it’s upper-right, down-left, etc… And the same thing for the other way around.

In my case, any sort of grid is impossible as the sizes of the different rectangles are all rather strange and completely different (yeah I know it’s stupid, but it’s a long story :p:).

Anywho, if there is someone who can give me an idea on how to start this thing, or where to take a further look, it would be very much appreciated.

grtz, zep