hi
i have several buttons in a menu with instance names. i added listeners to every one of them to load an external swf file when clicked. when the loading is completed, i call a function to place this swf into a movieClip. the code would be something like this:
mainLoader:Loader=new Loader();
mainLoader.contentLoaderInfo.addEventListener(Even t.COMPLETE,placeMain);
mainContainer:MovieClip=new MovieClip();
addChild(mainContainer);
scene1.addEventListener(MouseEvent.CLICK,loadswf);
function loadswf(evt:MouseEvent):void
{
mainLoader.load(new URLRequest(“Files/”+evt.target.name+".swf"));
}
function placeMain(evt:Event):void
{
if(mainContainer.numChildren!=0)
{
mainContainer.removeChildAt(0);
}
mainContainer.addChild(evt.target.content);
mainLoader.unload();
}
well the problem is that i get an error that says “The supplied DisplayObject must be a child of the caller.”, “Loader/unload”. or something like that.
why is this? what’s wrong? any idea?
i would appreciate any help, thanks.