Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
brybott
Visitor

setting background color field on scene graph scene nodes

So, I'm creating a component that extends scene and using it and passing it to roSGScreen. Scene nodes have a backgroundColor field as well as a backgroundUri field. I see in the VOD Banner example, you can set the backgroundUri. But I can't set a backgroundColor.

The documentation (see link below) says that the backgroundColor field takes a color which should be a "color type". Doing something like:

m.top.backgroundColor = "0xFF0000FF"

in the script section of the scene component does not give any result. Is this expected behavior? A bug? Am I doing something wrong? How can I set the background color of the scene?
(I know I can create a rectangle node the size of the screen and set it as a background layer, but I think it would be preferable to set the background color of the scene directly).

https://sdkdocs.roku.com/pages/viewpage ... Id=1608549
0 Kudos
4 REPLIES 4
NewManLiving
Visitor

Re: setting background color field on scene graph scene node

In the init function
Try explicitly setting the m.Top.backgroundURI = "" first
Then set the color m.Top.backgroundColor = &hFFFFFFFF

This Scene Graph is more convoluted then the 2D
That's how I got it to work. But you should not have to spend hours on every step in the process trying to figure out why nothing works as expected. Even though I believe The last time I read it that uri has precedent and there is a default value - could be wrong. So if that was/is the case then you need to set it to an empty string first before the color value is looked at.
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
TheEndless
Channel Surfer

Re: setting background color field on scene graph scene node

"NewManLiving" wrote:
In the init function
Try explicitly setting the m.Top.backgroundURI = "" first
Then set the color m.Top.backgroundColor = &hFFFFFFFF

That's correct. The backgroundColor only works if you clear the backgroundURI first. I'm not sure if that's by design or not, but it took me awhile to figure it out, too.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
brybott
Visitor

Re: setting background color field on scene graph scene node

Thanks folks for the response. The weird part is, when I was trying it, I didn't even have a backgroundUri set up, so the field should have defaulted to invalid, as it says in the documentation. It's strange that in order for backgroundColor to work, backgroundUri has to be set specifically to an empty string.
0 Kudos
TAC
Channel Surfer

Re: setting background color field on scene graph scene nodes

Thank you folks. Struggled with this forever.
Not only should it default, it appears to do just that because if you print it to the console (between two text strings), it prints just as an empty string should. 
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.