Racing game, keeping car in bounderies

I’m trying to make a racing game, but I don’t know how to keep the car from going off the track. So far I just have it so when you go off the track you’re car’s alpha goes to 50. Does anyone know how I would keep it from going off?

You could check this engine too , it’s working pretty good .
http://www.markfennell.com/flash/using.html

That one also has a bug. In that game, when you hit an object, if you keep pressing forward and then turn your car, you can get inside things.