Issue about cc.MenuItemFont in Cocos2d-html5-v2.0

Issue about cc.MenuItemFont in Cocos2d-html5-v2.0
0.0 0


I use cc.MenuItemFont in my js app, lik this:

var item1 = cc.MenuItemFont.create(“Stop Game”, this, this.onItem1);

// Change size and color of items
item1.setFontSize( 20 );
item1.setColor( cc.c3b(192,192,192));

It show the error:
TypeError: ‘undefined’ is not a function (evaluating ‘item1.setFontSize( 20 )’)

Why? How to solve it? Thank you!


use this function : item1.setFontSizeObj( 20 );


Thank you very much!
But can you tell me why? I use setFontSize in iOS-js binding, the document say “The cocos2d-html5 API and the cocos2d-iphone + JS API, are exactly the same API. If you use the cocos2d JS API, your code will run both on Web Browses and Mobile Devices without changing a single line of code.”, but why I must use setFontSizeObj in web?

I get another issue :

CCLayer.js:495 TypeError: ‘undefined’ is not an object (evaluating ‘this._squareColors[0].r’)

Thank you!