Hi,
one of you forum readers might get the title for “AS-Guru of all time” pointing me the solution to THIS:
I’m publishing an SWF file on domainA and loading every graphical assets and included classes from another SWF located on domainB.
It’s great.
Locally.
I mean that when the two files are loaded locally side by side, everything rolls fine.
As soon as I’m trying to load the assets library from domainB, I get a runtime error #1009 (null object reference).
The following “crossdomain.xml” is hosted on domainB :
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-access-from domain="localhost" />
<allow-access-from domain="127.0.0.1" />
</cross-domain-policy>
but doesn’t seems to accept remote serving of an SWF from another.
I worked my way around security issues by declaring in the first frame of the library SWF
Security.allowDomain("*");
(now that’s security…)
and the library assets gets loaded fine from domainB, like this:
var path:URLRequest = new URLRequest(Config.SERVER_PATH + "assets/assets.swf");
var context:LoaderContext = new LoaderContext(true, ApplicationDomain.currentDomain);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onAssetsLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
loader.load(path, context);
Or do they?
The classes associated with the linked library assets gets loaded fine too, as I can instantiate them.
The thing is every time there’s a sub-clip inside one of them, it doesn’t seem to get defined at all.
For instance, I have SimpleButton called “replay_btn” inside a movieClip linked with “OptionsButtons” class.
I have this
public var replay_btn:SimpleButton;
in the class definition.
I repeat : this is working fine when
Config.SERVER_PATH = ""
not anymore when
Config.SERVER_PATH = "domainB"
Winners might get recognition.
A whole lot’of’it.
I know many chicks.
Please help.