I am building a highscore system for my site, and I was wondering how to communicate with classes that are included in an external swf that i’ve loaded in.
Basically, how does mindjolt do this:
var urlLoader:Loader = new Loader();
urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFinished);
urlLoader.load(new URLRequest(gameParams.mjPath || "http://static.mindjolt.com/api/as3/api_as3_local.swf"));
this.addChild(urlLoader);
function loadFinished (e:Event):void {
MindJoltAPI=e.currentTarget.content;
if (MindJoltAPI != null) {
MindJoltAPI.service.connect(postMindJoltAPIConnect);
trace ("[MindJoltAPI] service successfully loaded");
} else {
trace("[MindJoltAPI] failed to load");
}
}
then somehow they can do this:
MindJoltAPI=e.currentTarget.content;
//and this
MindJoltAPI.service.connect(postMindJoltAPIConnect);
How do they/I do that?