A car game

I have a car game, but I want to be able to make obstacles for the car to go around, ect. I have thought of a simple way to stop the car from going “into” the objects, but don’t have the knowledge of actionscript to do it. Can someone please convert my idea into actual actionscript?

//script on car movieclip
//must have a movieclip with an instance name of “obstacle”
onClipEvent (enterFrame) {
lastx = the x position the car was at 3 frames ago
lasty = the y position the car was at 3 frames ago
if (this.hitTest(_root.obstacle)) {
ease x pos to lastx
ease y pos to lasty
}
}

so can someone please convert this into actual actionscript that will work?
a sample game is at (i know its a bit childish) : http://www.neopets.com/games/bumpercars.phtml

thanks
Zeka