Cannot access child attached dynamically

in my package I declared my vars

private var openedWindow:MovieClip;
private var window:windowMC;
private var myEmployeeClass:Class;
private var employee:MovieClip;
private var windowBTN:window_btn;
private var buttonHolder:Sprite;
private var windowHolder:Sprite;

I have a function where I attach my MCs:

Ex 1:
function blabla ()
{    
    windowBTN = new window_btn ();
    buttonHolder.addChild (windowBTN);
    
    for (j = 0; j < 10; j++)
    {
        window = new windowMC ();
        
        openedWindow = new window_opened ();
        window.addChild (openedWindow);
        
        employee = new opened0();
        window.addChild (employee);
    }
    
    windowBTN.addEventListener(MouseEvent.CLICK, windowClick);
}

private function windowClick (event:MouseEvent):void
{    
    for(var n=0; n<window.numChildren; n++)
    {
        var child = window.getChildAt(n);
        
        trace("child: "+child);
    }
}

// trace >>>
child: [object window_opened]
child: [object opened0]

Everything’s fine.

Now my problem is that I do not attach only one movie named “opened0”, but many MCs with names like “opened0”, “opened1”, “opened2” etc etc…
And as soon as I do so, the button click function won’t access any “window” child any more.

Ex 2:


function blabla ()
{    
    windowBTN = new window_btn ();
    buttonHolder.addChild (windowBTN);
    
    for (j = 0; j < 10; j++)
    {
        window = new windowMC ();
        
        openedWindow = new window_opened ();
        window.addChild (openedWindow);
        
        myEmployeeClass = getDefinitionByName("opened"+j) as Class;
        employee = new myEmployeeClass () as MovieClip;
        window.addChild (employee);
    }
    
    windowBTN.addEventListener(MouseEvent.CLICK, windowClick);
}

private function windowClick (event:MouseEvent):void
{    
    for(var n=0; n<window.numChildren; n++)
    {
        var child = window.getChildAt(n);
        
        trace("child: "+child);
    }
}

// trace >>>
NOTHING
because window has no numChildren

Is there any way to access these dynamiccaly attached MCs like when I instantiate in Ex 1? Thanx a lot. Would be very helpful!

[size=1][color=red]modEdit: Codetagged.[/color][/size]