I'm burnt out...please help

Today is my first day with AS3, I have spend the entire day trying to get this to work, but for some reason it just won’t…

I made an old film effect in AS2 a while back, thought i’d try to remake it in AS3, I’ll post both codes, hope someone can shed me some light.

AS2 code:

onEnterFrame = function ()
{
	for (i=1; i<23; i++)
	{
		attachMovie("line","line"+i,i,
		            {_x:random(550)})
	}
}

AS3 code:

function OldFX() {
	stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
	
	function onEnterFrame(event:Event):void
	{
	for (var i = 0; i < 25; i++)
	{
	
		var Lines:line = new line();
		Lines.name = "line"+i;
		Lines.x = (Math.random()*511);
		addChildAt(Lines,i);
	}
	}
}
OldFX();

The problem is, in AS2, the objects with the same depth will get swapped out automatically, but for some reason, in AS3, it just kept pilling up(covers up the entire screen), I traced getChildIndex, and it returned the correct index value…I really don’t know what’s wrong here. Someone please help…:stare: