00:00
00:00
Newgrounds Background Image Theme

xrusteater0 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Medals don't unlock

3,062 Views | 35 Replies
New Topic Respond to this Topic

Response to Medals don't unlock 2014-08-20 22:27:58


At 8/20/14 09:54 PM, indiest wrote: BTW, the format I used to upload is HTML5 Archive(zip) instead of Flash Game(swf), because my game has many resource files besides the main SWF. I'm also using swfobject.js in index.html.

Well that's your problem (helpful info!!!). There's a limited js version of the api.

Response to Medals don't unlock 2014-08-20 22:53:41


At 8/20/14 10:27 PM, MSGhero wrote:
At 8/20/14 09:54 PM, indiest wrote: BTW, the format I used to upload is HTML5 Archive(zip) instead of Flash Game(swf), because my game has many resource files besides the main SWF. I'm also using swfobject.js in index.html.
Well that's your problem (helpful info!!!). There's a limited js version of the api.

You mean I can't use the Flash API in the SWF if the whole game is uploaded as a ZIP?

Response to Medals don't unlock 2014-08-20 23:07:16


At 8/20/14 10:53 PM, indiest wrote: You mean I can't use the Flash API in the SWF if the whole game is uploaded as a ZIP?

Apparently not, as the api parameters are passed to the swf by flashvars which html5 games don't have.

Response to Medals don't unlock 2014-08-20 23:30:26


At 8/20/14 11:07 PM, MSGhero wrote:
At 8/20/14 10:53 PM, indiest wrote: You mean I can't use the Flash API in the SWF if the whole game is uploaded as a ZIP?
Apparently not, as the api parameters are passed to the swf by flashvars which html5 games don't have.

Can I add the flashvars to my index.html manually? Or load them by javascript and pass them to the SWF.

Response to Medals don't unlock 2014-08-21 00:19:53


At 8/20/14 11:30 PM, indiest wrote: Can I add the flashvars to my index.html manually? Or load them by javascript and pass them to the SWF.

No and maybe. You can't tell the game what the user's username is considering there's more than one user. Can't you just embed all your files into the swf like normal?

Response to Medals don't unlock 2014-08-21 04:54:14


At 8/21/14 12:19 AM, MSGhero wrote:
At 8/20/14 11:30 PM, indiest wrote: Can I add the flashvars to my index.html manually? Or load them by javascript and pass them to the SWF.
No and maybe. You can't tell the game what the user's username is considering there's more than one user. Can't you just embed all your files into the swf like normal?

I added some code to index.html to pass the flashvars read from the outer iframe. Here's the code:

function getJsonFromUrl() {
var query = location.search.substr(1);
var data = query.split("&");
var result = {};
for(var i=0; i<data.length; i++) {
var item = data[i].split("=");
result[item[0]] = decodeURIComponent(item[1]);
}
return result;
}
var flashvars = getJsonFromUrl();

Now it seems to work for me. The reason I can't embed all my files into one swf is they sum up to ~40MB...