I have a series of swfs that I am loading externally. Some swfs have a movie clip named ‘DownloadMC’. I am trying to check if the movie clip exists, but I keep getting an error.
var theMC= MyLoadedMC.getChildAt(timesLoadCalled);// theMC is a loader object so use MovieClip(theMC.content)
trace('it exsists because here is the name: '+MovieClip(theMC.content).DownloadMC.name);//traces 'DownloadMC'
if(MovieClip(theMC.content).getChildByName('DownloadMC') != null){ var CallTopic:Sprite = new Sprite();
CallTopic.name = "CallTopic";
CallTopic.graphics.beginFill(0xFF2200,1);
CallTopic.graphics.drawRect(MovieClip(theMC.content).DownloadMC.x, MovieClip(theMC.content).DownloadMC.y, MovieClip(theMC.content).DownloadMC.width,MovieClip(theMC.content).DownloadMC.height);
MovieClip(theMC.content).addChild(CallTopic);
}
the code above gives me an error in the output:
TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-464()
I should say that the code works if ‘DownloadMC’ exists in the loaded movieclip, but if ‘DownloadMC’ does not exist in the loaded movieclip, then I get the error:
TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-464()