# Problems casting a remote-loaded SWF

**URL:** <https://forum.kirupa.com/t/problems-casting-a-remote-loaded-swf/224356>\
**Category:** flash\
**Created:** [May 1, 2007, 7:02pm UTC](https://forum.kirupa.com/t/problems-casting-a-remote-loaded-swf/224356 "2007-05-01T19:02:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pooya](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pooya](https://forum.kirupa.com/u/pooya)\
**Post date:** [May 1, 2007, 7:02pm UTC](https://forum.kirupa.com/t/problems-casting-a-remote-loaded-swf/224356/1 "2007-05-01T19:02:18Z")

</div>

Let’s say I have 3 items in the same package:  
[LIST]  
[_]Shouter interface - requires implementers to implement the shout() function  
[_]Shell class - implements Shouter…this Shell.swf is to be loaded remotely from:  
[\*]ShellLoader class - loads Shell from a remote server, casts it as a Shouter and invokes its shout() function…uses allowDomain in order to cross-domain script.[/LIST]Now let’s say ShellLoader.swf lives on [a.com](http://a.com) and Shell.swf lives on [b.com](http://b.com)…I’ve got a cross-domain policy on [b.com](http://b.com). Using LoaderContext’s ApplicationDomain and SecurityDomain, I’m able to load and cast the Shell object as a Shouter and invoke the shout() function. Everything ok here.

Now let’s say ShellLoader is run locally and is localTrusted. Shell.swf still lives on [b.com](http://b.com). I’m now unable to use SecurityDomain property of LoaderContext within ShellLoader because it is now run locally. Shell.swf now exists in a different ApplicationDomain as my ShellLoader and I get the error “Type Coercion failed” when I try to cast the loader content as a Shouter.

Is there anyway to resolve this issue? I believe it will require Shell.swf to be loaded in the same ApplicationDomain as ShellLoader but I don’t know any way to do this when ShellLoader is run locally. Perhaps this is prevented in the Flash player on purpose?
