Accessing API Through PreLoader

Subscribe to Accessing API Through PreLoader 7 posts

avatar for newberry94005 newberry94005 72 posts
Flag Post

I have a preloader.swf that loads my main.swf

If I just upload my main.swf the API works fine and I have no errors.

If I load the preloader.swf the communication to the API fails within the main.swf.

Any suggestions on how to get this to work?

Thanks,
Adam

 
avatar for UnknownGuardian UnknownGuardian 8136 posts
Flag Post

You must be doing something pretty wrong. Your preloader.swf should be able to access the Kongregate API just like your main.swf (theoretically) should be able to.

If you are using AS3, check out QuickKong (stickied at the top of this forum) and integrate it into your preloader.swf.

Make sure you alot enough time for the Kongregate API to actually load as well.

 
avatar for newberry94005 newberry94005 72 posts
Flag Post

I did not call for the API in the Preloader. Only in the main.swf file. Once the main.swf is loaded, it should then load the API. It does not.

If I skip the preloader and only upload the main.swf as the main file it loads the API perfectly.

Should I load the API in the Preloader and in the main.swf? I am sending stats: kongregate.stats.submit(“Stat”,1) – from the main.swf because that is where the variables are changed and updated.

Thanks for the info UnkownGuardian. I will check out QuickKong but I think I am still missing something here.

 
avatar for newberry94005 newberry94005 72 posts
Flag Post

Thanks again UnknownGuardian!

I refit my game with QuickKong and it works perfectly now :-)

 
avatar for UnknownGuardian UnknownGuardian 8136 posts
Flag Post

Great! Always good to know that the package helps people out.

 
avatar for jojoblomo jojoblomo 1 post
Flag Post

I was having this issue as well. Turned out it was built in flash security, if you are loading from a hyperlink “blahblah.com/storingmygamehere.swf” you need to use Security.allowDomain("domainname or * ");

import flash.system.Security for that

 
avatar for newberry94005 newberry94005 72 posts
Flag Post

Thanks jojoblomo! That seems to be the problem. The good thing is, there are multiple ways to get it running.