Cocos2d iOS Javascript Bindings and Subclassing

So I started to port the work-in-progress Solar Jetways to iOS this week, to see just how easily the HTML5 code can be ported. It’s been pretty painful so far (again due to a lack of community support I guess), but here’s a very valuable tip for anyone who’s getting “Invalid Proxy object” errors when starting their code. This happens when you’ve subclassed a Cocos2d native class and haven’t then called cc.associateWithNative() in the class constructor. Another gotcha is making sure that the class init() function is called before anything else.

As an example, here’s an excerpt from my subclassed cc.Scene:

var MyScene = cc.Scene.extend({
    cc.associateWithNative(this, cc.Scene);

  onEnter:function () {

Hope that helps someone. Now back to the ongoing cross-platform coding saga…