# SWF Loading and ApplicationDomain

**URL:** <https://forum.kirupa.com/t/swf-loading-and-applicationdomain/327640>\
**Category:** flash\
**Created:** [March 16, 2012, 12:12am UTC](https://forum.kirupa.com/t/swf-loading-and-applicationdomain/327640 "2012-03-16T00:12:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![riveroaks](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@riveroaks](https://forum.kirupa.com/u/riveroaks)\
**Post date:** [March 16, 2012, 12:12am UTC](https://forum.kirupa.com/t/swf-loading-and-applicationdomain/327640/1 "2012-03-16T00:12:46Z")

</div>

I am loading a content SWF into a container and I want the content SWF to exist in a child application domain to the container. Therefore, the structure should look like:

[system] -\> [container] -\> [content1]  
[system] -\> [container] -\> [content2]  
…

In my container SWF I load the content SWF with:

```auto

_newDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
var ldrContext:LoaderContext = new LoaderContext(false, _newDomain);
_swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
_swfLoader.load(swfRequest, ldrContext);

```

Then in my content SWF I added the following code to verify that the application domains were being setup correctly:

```auto

var parentDomain:ApplicationDomain = ApplicationDomain.currentDomain.parentDomain;
if (parentDomain == null)
{
     trace("Content is running on its own, no parent domain");
     return;
}

```

That if-statement is being triggered, meaning the content does not recognize the existence of a parent application domain.

Where am I going wrong here?
