Var and function help

I’m trying to write a function that automatically places each new mc I attach, or place on the stage above the other. I’ve been trying this, butit’s not working and I’m confusing my self.


//next highest depth after specified depth
var nextDepth:Number = 600;
//mc depth placement
var nextMC = "myMC" +nextDepth;

//puts mcs ontop of each other
function mcDepth(){
    _root.attachMovie("myMC", nextMC, nextDepth);
    nextDepth++;
    }

//and then I tried to call it like this:

mcDepth("movieclip1");


It doesn’t work. Mostly because I don’t know what I’m doing.
Can anyone explain why it doesn’t work and what I’m doing wrong?
I’m soo confused.
Thanks!