# XML data not working with externally loaded SWF file

**URL:** https://forum.kirupa.com/t/xml-data-not-working-with-externally-loaded-swf-file/323862
**Category:** flash
**Created:** [July 21, 2011, 1:28pm UTC](https://forum.kirupa.com/t/xml-data-not-working-with-externally-loaded-swf-file/323862 "2011-07-21T13:28:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pixelvoodoo425](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@pixelvoodoo425](https://forum.kirupa.com/u/pixelvoodoo425)
#### Post date: [July 21, 2011, 1:28pm UTC](https://forum.kirupa.com/t/xml-data-not-working-with-externally-loaded-swf-file/323862/1 "2011-07-21T13:28:34Z")

</div>

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???

```auto

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();
}

```
