Hello all. This is a problem in Flash, actually, not Flex, but i think
it might behave the same in Flex. Here's the scenario:
I have 4 SWF files: main.swf, platform.swf, pluginLoader.swf and
plugin.swf. pluginLoader.FLA and plugin.FLA are in the same folder, and
share some of the classes. At this point, they only share a PluginEvent
class. The flow is this: main.swf loads platform.swf; platform.swf loads
pluginLoader.swf; pluginLoader.swf loads the plugin.swf and here the
crazy stuff begins:
1. plugin.swf adds a listener for a PluginEvent event
2. pluginLoader.swf dispatches a PluginEvent event (both swf files use
the same file, from the same namespace)
3. Type coercion failed error occures.

One fix I found was to specifi the application domain when using
loader.load, and use ApplicationDomain.currentDomain, but that's not
working. Here's the loading code:

var pluginLoaderContext:LoaderContext = new LoaderContext();
pluginLoaderContext.applicationDomain = new
ApplicationDomain(ApplicationDomain.currentDomain);
var mRequest:URLRequest = new URLRequest(pluginURL);
pluginLoader.load(mRequest, pluginLoaderContext);

To top it off, if the pluginLoader.swf and plugin.swf are on the same
domain, everything works. If they're on different domains, the type
coercion appears. Should I use another ApplicationDomain? Any help would
be appreciated.

Reply via email to