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 and Shell.swf lives on b.com…I’ve got a cross-domain policy on 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. 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?