I did a basic gravity simulator a while ago but lost the .cap file
i remember the equation though
multiply the two masses, and then divide by the distance between the two.
you can then multiply that whole thing by a constant to fine tune how strong you want it.
i was using physics so it was
((body.physics.mass*body2.physics.mass)/distance(body.x,body.y,body2.x,body2.y))*constant
apply that force to both the body's towards each other. It worked perfectly
edit: i forgot, the distance between the bodies was squared
http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation