# Strsnge behavior from a loaded SWF

**URL:** <https://forum.kirupa.com/t/strsnge-behavior-from-a-loaded-swf/321567>\
**Category:** flash\
**Created:** [April 23, 2011, 6:42pm UTC](https://forum.kirupa.com/t/strsnge-behavior-from-a-loaded-swf/321567 "2011-04-23T18:42:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrobnett](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rrobnett](https://forum.kirupa.com/u/rrobnett)\
**Post date:** [April 23, 2011, 6:42pm UTC](https://forum.kirupa.com/t/strsnge-behavior-from-a-loaded-swf/321567/1 "2011-04-23T18:42:35Z")

</div>

I am trying to figure out why changes to variables and elements are not reflected when one SWF is loaded into another.

main.swf

```auto
 
var myLoader:Loader = new Loader();
myLoader.load(new URLRequest("products.swf"));
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
function finishLoading(loadEvent:Event):void {
    myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, finishLoading);
    myScrollPane.source = loadEvent.currentTarget.content;
    trace(loadEvent.currentTarget.content.bg.height);
    trace( Object(myLoader.content).myheight); 
    myScrollPane.update();
}

```

products.swf

```auto
 
var myheight:Number = 50;
bg.height = 500;
 
var productsXML:XML = new XML(); 
var productsLoader:URLLoader = new URLLoader(new URLRequest("http://shop.stevesmusicstuff.com/rsscategoryproducts.sc?categoryId=2")); 
var gdNs:Namespace = new Namespace("http://app.fastshoppingcart.com/rss/featuredProduct/1.0");
productsLoader.addEventListener(Event.COMPLETE, productsLoaded);
 
function productsLoaded(event:Event):void {
    productsXML = XML(productsLoader.data);
    var itemDisplay:productDisplay = new productDisplay();
    addChild(itemDisplay);
    itemDisplay.x = 257.45;
    itemDisplay.y = 390; //95;
    itemDisplay.productImage.source = productsXML.channel.item[0].gdNs::image.gdNs::image_link;
    itemDisplay.productTxt.htmlText = productsXML.channel.item[0].title;
    bg.height = 1000;
    myheight = 1000;
}

```

When the main file is tested the out put of the traces is 50 & 300 which is what the variable and the bg object are set to at the top instead of what they changed to in the productsLoaded(event:Event) function.  
It’s as if the myloader listener is ignoring changes to variables & elements inside of the loaded SWFs listener function.  
Seems wrong and very confusing.
