Space Game - Planet Physics Help

Hi, I’m doing a project, I basically want to create a little space game where your an asteroid and you go around the solar system and you can approach planets and orbit around them but so far I really haven’t been able to get it working.

A few days ago I found this neat little tutorial that lets the player orbit a planet fairly well. It was in as2 and I converted the gravity function to as3.

http://www.flashninjaclan.com/tutorialpage.php?ID=61

Now my game does do something but its odd, it seems to randomly force my asteroid to repel and follow strange paths. The planet just doesn’t seem to work.

Here’s the fla, I’d really appreciate any help or suggestions, its just so exhausting.

Thank you