AS3: Instantiating classes from loaded external SWF

52 Views Asked by At

I've been successful at loading an external SWF into my primary SWF, and I've been able to access the external SWF's classes because I loaded it into the same ApplicationDomain.

var exClass:Class = myAppDomain.getDefinition(my.stuff.com::externalClass) as Class;

But now if I want to instantiate exClass, do I have to use * as the type? In this case, exClass extends DisplayObject, so I have to do this to make it work:

var myInstanceExClass:* = new exClass(arg1,arg2);
addChild(myInstanceExClass);
myInstanceExClass.method1();

Is that the way you're supposed to do it? It seems I have to use * as the type because I'm not doing an import my.stuff.com.externalClass, which I do not want to do. Importing that class would defeat the purpose of loading the external SWF.

0

There are 0 best solutions below