Dynamically create class inside a class?

Hello!

This is what i’m trying to do :

I have 1 class that extends movieclip, let’s call it Class0.
I have 1 class that extends movieclip, let’s call it Class1.

I create an instance of Class0 on stage like :
var myClip0:Class0 = new Class0(this, “Class1”);

The class Class0 when initializing, will create a new movieclip (myClip1) and add it as child, as an instance of Class1, like myClip0.myClip1. But it’s when i create that clip, i want to tell it, it’s an instance of Class1, like :

private var myClip1:Class1 = new Class1(this);

Where Class1 could be any class.

How do i pass Class1 to Class0 so it can create it dynamically?? Do i have to use the apply function??

EDIT :

inside Class0, i have a function that does :

if(subClass){
initSubclass(subClass);
}

private function initSubclass(type:Class):void {			
var subClass = new type(this);
addChild(subClass);			
}
}

But that gives me the error :

TypeError: Error #1034: Type Coercion failed: cannot convert subClass to Class

And if i try :

private function initSubclass(type:String):void {			
var _class:Class = getDefinitionByName(type) as Class;

I get ReferenceError: Error #1065: Variable subClass is not defined.

But it works if i do a simple :

var test:subClass = new subClass(this);

(where subClass here is the name of the Class)