Simple ChangeDepths problem, but Hard for Me


I’m trying to apply a ChangeDepths() to a bunch movieclips that I’ve nested inside a main movieclip which I’m using as a mask. The ChangeDepths() function worked fine when the clips were not nested, but after I placed them in a new movieclip, I get this error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/setChildIndex()
at test10_fla::MainTimeline/ChangeDepths()

Here is my code:

// create mask shape
var maskShape:Shape = new Shape(); 0xff0000 ); 20, 20, 970, 241 );


// create mask container, then add my movieclips to use ChangeDepths() on rollover
var maskContainer:MovieClip = new MovieClip;

maskContainer.x = 0;
maskContainer.y = 0;
maskContainer.mask = maskShape;

addChild( maskContainer );

    maskContainer.addChild( person1_mc );
    maskContainer.addChild( person2_mc );
    maskContainer.addChild( person3_mc );
    maskContainer.addChild( person4_mc );
    maskContainer.addChild( person5_mc );
    maskContainer.addChild( person6_mc );

// change depths on rollover
function ChangeDepths( event:MouseEvent ):void
var button:MovieClip = as MovieClip;

setChildIndex( button, numChildren - 1 );


Any help would be greatly appreciated!!!