I would like to change a background color, so I use cc.LayerColor to do the job.
But I always get error saying that “Uncaught Error: SYNTAX_ERR: DOM Exception 12 /tkappshared/Cocos2d-html5-canvasmenu-min.js:271”.
I used the following code.
`init:function () {
var bRet = false;
if (this._super) {
// preload sfx
if(!util.isiOSDevice())
{
cc.AudioManager.sharedEngine().preloadEffect(res_game_bell_sfx);
cc.AudioManager.sharedEngine().preloadEffect(res_game_pop_sfx);
}
// -- Game Screen --
this._yellowFrame = cc.Sprite.create(res_game_yellowFrame);
this._yellowFrame.setPosition(centerPos);
//this.addChild(this._yellowFrame);
this._bgLayerColor = cc.LayerColor.create(cc.ccc3(0x66, 0xcc, 0x00), winSize.width, winSize.height);
this._bgLayerColor.setPosition(centerPos);
this._bgLayerColor.addChild(this._yellowFrame);
this.addChild(this._bgLayerColor);
bRet = true;
}
return bRet;
}`
I do think it’s the correct way to use LayerColor.