Recent posts by Dobbz23554 on Kongregate

Flag Post

Topic: Kongregate APIs / Unable to load AS3 API

I was under the same impression… No clue why sandbox violation if the loader isnt in the display list but thats definately what the issue was.

Thanks again!
Happy Coding!

 
Flag Post

Topic: Kongregate APIs / Unable to load AS3 API

Found my issue. I forgot to add the loader to the stage. Code below works properly. Hopefully this post will help someone (although this forum really needs a search feature).

var kongregateApiPath:String = "";
if (Application.application.parameters[“kongregate_api_path”])
kongregateApiPath = Application.application.parameters[“kongregate_api_path”];
else
kongregateApiPath = "http://www.kongregate.com/flash/API_AS3_Local.swf”;

Security.allowDomain(“*”);
Security.allowInsecureDomain(“*”);

var request:URLRequest = new URLRequest(kongregateApiPath);

var loader:Loader = new Loader();
stage.addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onKongApiLoadComplete);

loader.load(request);

Make sure you’re running this code in the applicationComplete handler or your stage will be null.

 
Flag Post

Topic: Kongregate APIs / Unable to load AS3 API

There doesnt seem to be a search associated with just this forum, so I’m posting this question without properly researching the forums because I cannot find a way to lookup relevant information.

I’m attempting to port a game from Facebook to Kongregate. This is an IFrame game using Flash built with the Flex 3.5 SDK.

I have not been able to get the AS3 API to load due to security sandbox violations when testing through the Kongregate Preview. I do not have any issues loading the local API (http://www.kongregate.com/flash/API_AS3_Local.swf)

I have tried

Security.allowDomain(“*”);
Security.allowInsecureDomain(“*”);

I have tried with and without setting the LoaderContext.

Can someone please enlighten me? Is Kongregate.com’s crossdomain.xml file??

URL:

http://chat.kongregate.com/flash/API_AS3_de614ba32910c407ff307ec996cd79e4.swf

CODE:

var kongregateApiPath:String = "";
if (Application.application.parameters[“kongregate_api_path”])
kongregateApiPath = Application.application.parameters[“kongregate_api_path”];
else
kongregateApiPath = "http://www.kongregate.com/flash/API_AS3_Local.swf”;

Security.allowDomain(“*”);
Security.allowInsecureDomain(“*”);

var request:URLRequest = new URLRequest(kongregateApiPath);

var loader:Loader = new Loader();
var lc:LoaderContext = new LoaderContext();
lc.securityDomain = SecurityDomain.currentDomain;
lc.applicationDomain = ApplicationDomain.currentDomain;

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onKongApiLoadComplete);

loader.load(request, lc);

ERROR:

Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security sandbox violation: http://mydomain.com/Dev/ClientInterface_2.swf cannot load data from http://chat.kongregate.com/flash/API_AS3_de614ba32910c407ff307ec996cd79e4.swf.

Thanks for the help!