XML data not working with externally loaded SWF file

Hi,

I am new to AS3 and my apologies if this is a silly question.

I have successfully loaded XML data into a SWF file and am able to get values from the XML without much problem. The code works. For example my test productimage[1].toString(); is returning back the correct value from the XML file.

My issue is when I load this SWF into another, a preloader, the code no longer works? The preloader is working fine and the rest of the SWF file is loaded in succesffully, even the XML data appears to be working when I run a trace i.e. trace(e.target.data.toString()), but for some reason the individual data values such as productimage are no longer being defined???


var requestXML:URLRequest = new URLRequest("liveshow.xml");

var loader:URLLoader = new URLLoader();
loader.load(requestXML);

loader.addEventListener(Event.COMPLETE, onLoaded);

var showxml:XML;

//Event listner, calls a function when XML fails to load
loader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadFail);

function xmlLoadFail(event:IOErrorEvent):void
{
    //trace("XML LOAD FAILED");
    txtEvents.text = "XML LOAD FAILED";
}

function onLoaded(e:Event):void
{
    //trace("XML LOADED")
    showxml = new XML(e.target.data);
    
    productimage = showxml.show.(showcode == liveshow).productsinshow.product.productimgurl.text();
    product_total = showxml.show.(showcode == liveshow).productsinshow.product.length();
    productid = showxml.show.(showcode == liveshow).productsinshow.product.productid.text();
    producttitle = showxml.show.(showcode == liveshow).productsinshow.product.producttitle.text();
    productprice = showxml.show.(showcode == liveshow).productsinshow.product.productprice.text();
    
    txtEvents.text = productimage[1].toString();
}