Plugin failing when exported

For developers using the Construct 2 Javascript SDK

Post » Tue Jan 29, 2013 10:00 pm

Hi, I've just tried exporting my game, which makes use of a few custom plugins I've written (well, one behaviour and one plugin, to be precise).

The game works great in local preview mode but, when trying to use a feature in the exported HTML5 game that triggers an action in the plugin, Firebug throws a TypeError: c.bj is undefined.

This would seem to meet the exact description given at http://www.scirra.com/tutorials/147/checking-for-errors-in-browsers/page-1 of :
"Game works in preview but not after exporting
This is usually caused by broken third-party plugins and behaviors which do not work with the minifier. The error message will probably include random characters like P.wf is undefined. You should report the problem to the plugin or behavior developer.
"

So, I *am* the plugin developer... what sort of issues should I be looking for in my plugin that would upset the minifier?
B
8
S
2
G
3
Posts: 83
Reputation: 2,668

Post » Tue Jan 29, 2013 10:45 pm

sounds like sth was broken with the minifier - try without ticking the option and see.
If so, do a search in the forum, Ashley gave some tips about it.
(e.g replace all A.b by A["b"])
B
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » Wed Jan 30, 2013 9:58 am

Ah great, thanks for the tip (didn't find the post at http://www.scirra.com/forum/plugin-developers-please-test-with-the-minifier_topic45502_page1.html before - think I must have searched the wrong subforum :(

I wasn't "mixing" notation, but changing all my object.property dot syntax accessors to bracket object["property"] seems to have done the trick. A marginal cost to the readability of the code, but at least it now works - thanks!
B
8
S
2
G
3
Posts: 83
Reputation: 2,668


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests