Problem using cc.LayerColor -> Uncaught Error: SYNTAX_ERR: DOM Exception 12

Problem using cc.LayerColor -> Uncaught Error: SYNTAX_ERR: DOM Exception 12
0.0 0


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

        // -- Game Screen --
        this._yellowFrame = cc.Sprite.create(res_game_yellowFrame);

        this._bgLayerColor = cc.LayerColor.create(cc.ccc3(0x66, 0xcc, 0x00), winSize.width, winSize.height);

        bRet = true;
    return bRet;

I do think it’s the correct way to use LayerColor.


The arguments of cc.LayerColor.create type is cc.Color4B. the code in Tests/ClickAndMoveTest is:
var layer = cc.LayerColor.create(cc.c4(255, 255, 0, 100)); this.addChild(layer, -1);


Thanks dingping, that solved my problem
The online reference said it needs Color3B. I would think it’s not updated yet.

Just a catch up, it should be “cc.ccc4”. :slight_smile:


You are welcome!

Yes, the online reference need change.

We’ll change the new API reference after new version release.