Load XML into external SWF file


I’m trying to load XML into text boxes in external swf files

I have two dynamic text boxes: mainText and pageNum. It will load xml into one or the other, but not both at the same time.

here is my code:

var loader:URLLoader;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void {
   var myXML:XML = new XML(loader.data);

   _externalMovie =MovieClip(_swfContainer.content).mainText.text =myXML.CONTENT;
   _externalMovie =MovieClip(_swfContainer.content).pageNum.text =myXML.PAGENUM;

If I comment out the line that contains myXML.CONTENT, then the line that contains myXML.PAGENUM will load into the appropriate text box of the external SWF

I also get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert [email protected] to flash.display.MovieClip.
at main_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

Any help would be appreciated

I fixed it. I changed it to:

_externalMovie.mainText.text =myXML.CONTENT;
_externalMovie.pageNum.text =myXML.PAGENUM;