I have one swf(loaded.swf) file that contains a class called “GraphicQ”
I load this file to another swf file(Test.swf) and then try to instantiate the GraphicQ class but in this Test.swf
I manage to get the class definition but when I try to add the child to the stage I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
And here is the code:
private var ldr:Loader = new Loader();
//constructor
public function Test()
{
var url:String = "loader.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
}
private function onComplete(event:Event):void {
var tst:MovieClip = event.target.applicationDomain.getDefinition("GraphicQ") as MovieClip;
addChild(tst);
}
}