Hi all!
I’m still new on Cocos2d-x, and i’m not familiar with C++, so i’m veeery happy with the javascript bindings!
I’m using the 3.0alpha0pre version (2.1.4 for some reason don’t compile for android on my mac, 3.0 works like a charm and the 2.1.5 html5 version for html5 testing…
My problem is… i’m trying to do a simple animation… on Firefox it works flawlessly, but into the iPhone Simulator, it hangs… the console says:
@Cocos2d: JS: /Users/vinicius/Library/Application Support/iPhone Simulator/6.1/Applications/9938DA0A-D403-4CE3-B1EA-6E3C957E8D81/OneMoreTest.app/src/myApp.js:72:Error: Invalid Native Object@
I readed that this could be an autorelease issue of cpp, that differs from js on browser… so i tried to put .retain in everything… and the problem continues…
Here is the code)
var SplashLayer = cc.Layer.extend({
ctor:function(){
this._super();
cc.associateWithNative(this, cc.Layer);
},
init:function(){
this._super();
var splash = cc.Sprite.create(s_splashscreen);
splash.setPosition(cc.p(splash.getContentSize().width/2, splash.getContentSize().height/2));
this.addChild(splash);
audio_engine.playEffect(s_snd_tada);
// Attempt to use retain to make it work on Xcode
/*
var scene = new StartMenuScene();
scene.retain();
cc1 = cc.DelayTime.create(2);
cc1.retain();
cc2 = cc.TintTo.create(0.5, 0, 0, 0);
cc2.retain();
cc3 = cc.DelayTime.create(0.5);
cc3.retain();
cc4 = cc.CallFunc.create(function(node) {
cc.Director.getInstance().replaceScene(scene);
}, this);
cc4.retain();
ccs = cc.Sequence.create([cc1, cc2, cc3, cc4]);
ccs.retain();
splash.runAction(ccs);
*/
// Works on HTML5
splash.runAction(cc.Sequence.create([
cc.DelayTime.create(2),
cc.TintTo.create(0.5, 0, 0, 0),
cc.DelayTime.create(0.5),
cc.CallFunc.create(function(node) {
cc.Director.getInstance().replaceScene(new StartMenuScene());
}, this)
]));
}
})