Magnetic Action?

Anyone got any hints, example code or suggestions for making magnetic buttons/mc? i.e. buttons/mc’s float randomly around stage. When the mouse is within a certain range/distance the buttons speed up towards the mouse’s position. When the user moves the mouse off the button again, it carries on it’s random motion again.