Car game

Hello,
I am trying to develop a car game; the kind you have a perspective view of the road and of the objects you encounter.
I cannot manage to generate random objects in a satisfactory way.
I do like this to generate the trees:

function create trees():Void {
if (i<20) {
attachMovie(“tree”, “tree”+i, i);
this[“tree”+i].dir = Math.floor(Math.random()*2);
i++;
}
}
intervalId = setInterval(this, “createtree”, duration);

so that I have 20 trees and when a tree goes out from the stage I make him reenter in the correct position. I always use the same 20 trees.
But now the major problems are the cars; if I write a similar code to the one above, at first it goes properly but soon I get an enormous numbers of car and it is difficult to manage them.
Please help me; I ahve also tries to generate cars like this:

function createcars() {
if (random(15) == 0) {
attachMovie(“civic_traffico”, “b”+k, k, {_x:(random(110)+220), _y:190});
this[“b”+k]._xscale = 10;
this[“b”+k]._yscale = 10;
this[“b”+k].hit._xscale = this[“b”+k].hit._yscale=10;
traffico[traffico.length] = k;
k++;
if (((this[“b”+k-1]._x-this[“b”+k]._x)<60) and ((this[“b”+k-1]._y-this[“b”+k]._y)<50)) {
removeMovieClip(this[“b”+k]);
}
}
}

but after a while my trees disappear and I can see only cars.