diff --git a/frameworks/js-bindings/bindings/script/jsb_spine.js b/frameworks/js-bindings/bindings/script/jsb_spine.js index f8d48d1f12..cb6e4acf57 100644 --- a/frameworks/js-bindings/bindings/script/jsb_spine.js +++ b/frameworks/js-bindings/bindings/script/jsb_spine.js @@ -22,8 +22,12 @@ sp.SkeletonAnimation.prototype._ctor = function(skeletonDataFile, atlasFile, scale) { if(atlasFile) { - this.initWithFile(skeletonDataFile, atlasFile, scale); - this.initialize(); + if (isNaN(scale)) { + scale = 1; + } + + this.initWithFile(skeletonDataFile, atlasFile, scale); + this.initialize(); } }; diff --git a/samples/js-tests/src/SpineTest/SpineTest.js b/samples/js-tests/src/SpineTest/SpineTest.js index 8d47e49894..11e47c05c0 100644 --- a/samples/js-tests/src/SpineTest/SpineTest.js +++ b/samples/js-tests/src/SpineTest/SpineTest.js @@ -82,7 +82,14 @@ var SpineTest = BaseTestLayer.extend({ // Make Spine's Animated skeleton Node // You need 'json + atlas + image' resource files to make it. // No JS binding for spine-c in this version. So, only file loading is supported. - var spineBoy = sp.SkeletonAnimation.create('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas'); + var SpineBoyAnimation = sp.SkeletonAnimation.extend({ + ctor: function() { + this._super('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas'); + cc.log("Extended SkeletonAnimation"); + } + }); + + var spineBoy = new SpineBoyAnimation(); spineBoy.setPosition(cc.p(size.width / 2, size.height / 2 - 150)); spineBoy.setAnimation(0, 'walk', true); spineBoy.setMix('walk', 'jump', 0.2);