Dynamically change scene background

I’m using a custom pre-loading image and thus, according the the guide on the forum, I have made the scene’s background transparent.

However, now, I had to add background colour to the scenes, so, I just created a rectangle and kept it in the end.

But, I also had to create a new scene. Now, this scene’s height is really small. So, screens can see the area below the box. Thus, the white colour of the page is visible.

I could have added a body background colour same as the one of the box in the generated HTML file, but, the colour of the box has to change on a mouse over event (on a button).

So, how can I change the colour of my page to match that of the box?

I’d have attached my .hype file, but, I’m not around my system now. I’ll do at as soon as possible.

Okay. I solved this by some Google searches.

I added this in <head>:

<script>
    function changeBodyBg(color)
        {
            document.body.style.background = color;
        }
</script>

and then, created a JavaScript function:

changeBodyBg('#212121');

and then, ran that function on button hover.

2 Likes