Here is some simple code I am using to try to put two yellow blocks on the screen. I can’t seem to get the getNextHighestDepth function to work. What am I doing wrong here? I have tried using this.getNextHighestDepth() and _root.getNextHighestDepth(); If I use the blocks number which increments, both show up so they are on different depths, but I’d like to use the automatic number.
How do I use this function?
Block = function(shape,x,y){
this.shape = shape;
this.clip = _root.attachMovie(shape, "block_"+_root.blocks, this.getNextHighestDepth());
this.clip._x = x;
this.clip._y = y;
_root.blocks++;
trace(this.clip);
trace(this.clip._depth);
};
blocks = 1;
b = new Block("block",0,0);
b = new Block("block",35,0);
Output:
_level0.block_1
undefined
_level0.block_2
undefined