Recent posts by shuurai on Kongregate

Subscribe to Recent posts by shuurai on Kongregate

avatar for shuurai shuurai 3 posts
Flag Post

Topic: Game Programming / API Problem with MAnual Loading

/*
* Called when PlayerClient instantiates on Stage
* @param evt
*/
public function onAddedToStage(evt:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

/
*
* Kongregate Stuff
*/
// Pull the API path from the FlashVars
var paramObj:Object = LoaderInfo(root.loaderInfo).parameters;
//ExternalInterface.call(“alert”, "ParamObj: “+paramObj);
// The API path. The debug version (”shadow" API) will load if testing locally.
var api_url:String = paramObj.api_path || “http://www.kongregate.com/flash/API_AS3_Local.swf”;

// Debug
trace ( "API path: " + api_url );

// Load the API
var request:URLRequest = new URLRequest ( api_url );
var loader:Loader = new Loader();

var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);

loader.contentLoaderInfo.addEventListener ( Event.COMPLETE, onLoadComplete );
loader.load ( request, context );
stage.addChild ( loader );
}

private function onLoadComplete(evt:Event):void
{
trace(“GameKongregate: onLoadComplete”);
// Save Kongregate API reference
kongregate = evt.target.content;
// Connect

if (kongregate && kongregate.services) {
kongregate.services.connect();
}
//kongregate.addEventListener(KongregateEvent.COMPLETE, onServicesComplete);

}

 
avatar for shuurai shuurai 3 posts
Flag Post

Topic: Game Programming / API Problem with MAnual Loading

I get a null error with kongregate.services.connect() inside the function onLoadedComplete(evt:Event)…

 
avatar for shuurai shuurai 3 posts
Flag Post

Topic: Game Programming / API Problem with MAnual Loading

Has anyone tried loading the API manually?

My test fails when I upload for preview but works when I test locally as it loads that shadow test copy.

Its killing my brain…….arrrrrrrr