How to change default background color in Scene

Hi
I create a scene (sceneA) without background image, add some sprite.
I add background (bgB) in body tag in index.html.
When run on browser, sceneA always have default background color black.
I want sceneA have transparent background color if i don’t set background image.
I want to use background in body tag instead.
Sorry for my bad english :(.

Hi, kaka

Try this:

cc.director.setClearColor(cc.color(0, 0, 0, 0))
5 Likes

sorry for late reply. Thank u so much, it work :smiley:

Hi.
I have the same problem, and i call cc.director.setClearColor(cc.color(0, 0, 0, 0)) in onload function of scene, but my scene on web still black background. Do you need change anything in the css file?

Can you change it in the properties of the scene?

I have the same issue.

I set cc.director.setClearColor(cc.color(0, 0, 0, 0))
but still I get black background for the scene.

Is there any fix for this?

It works, try in this way.
cc.director.setClearColor(cc.color(255, 255, 255));

@cruzlutor, I tried it but instead of black background I am getting white background now.

It is not transparent.

Is there any other settings I need to set?

Can anyone provide some help on this?

Sorry my English is not good.

In render mode is Webgl, you can not set to transparent.
In render mode is Canvas, you can set to transparent - cc.director.setClearColor(0, 0, 0, 0) + Adjust index.html css

I’m facing to the same issue. It always shows a solid background instead of transparent when I use cc.director.setClearColor(cc.Color(0,0,0,0)).

Is there any helps ?