Hello, I am trying to set the background colour of my Initial screen through Brightscript:
m.top.backgroundURI = ""
'm.Top.backgroundcolor = "0xe231a3"
m.top.backgroundColor = "0xe231a3"
But, 1) it is not being set 2) I am getting the following warnings:
Warning occurred while setting a field of an RoSGNode
-- Tried to set nonexistent field "backgrounduri" of a "InitialScreen" node
pkg:/components/InitialScreen/InitialScreen.brs(2)
Warning occurred while setting a field of an RoSGNode
-- Tried to set nonexistent field "backgroundcolor" of a "InitialScreen" node
pkg:/components/InitialScreen/InitialScreen.brs(4)
what is this warning, I have done this before once on a screensaver where I set its background to be black, but now it is giving me a warning. How to fix this?
Screens do not come with backgrounds pre-built on them. You would build a full screen rectangle in the XML. Add an interface field for the backgrounduri to pass through. Then reference that rectangle inside the BRS using the m.top.backgrounduri to set as the URI for your rectangle which would be the background.
The interface field "backgrounduri" does not exist in the scope or component you are trying to access.
What exactly is initialscreen.brs? Does it have an initialscreen.xml along with it? Does that xml have an <interface> section with any <field> listed? Does it have a rectangle that is the background?
Yeah, initial screen is the first screen that is displayed. It has its own InitialScreen.xml and InitialScreen.brs with an interface that has fields in it.
<?xml version="1.0" encoding="utf-8"?>
<component name="InitialScreen" extends="Group" initialFocus="exampleKeyboard">
<script type="text/brightscript" uri="InitialScreen.brs" />
<interface>
<field id="reelButtonSelected" type="intarray" alwaysnotify="true"
alias="searchReels.buttonSelected" />
</interface>
<children>
<Label
id="searchHeading"
text="Search Instagram Hashtags"
translation="[90, 90]"
font="font:LargeBoldSystemFont"
/>
<MiniKeyboard
id="exampleKeyboard"
translation="[100, 150]"
/>
<Button
id="searchReels"
text="Search"
showFocusFootprint="true"
minWidth="140"
translation="[200,620]"
opacity="1.0"
/>
<Label
id="queryHeading"
text="Recent Searches:"
translation="[640, 90]"
font="font:LargeBoldSystemFont"
/>
<LabelList translation="[640,150]" id="queryList" itemSize="[130,50]" numRows="10" />
</children>
</component>
Although I did the exact same thing in a screen saver, where I set the background to black using the same two lines. A solution online does the same thing. And back then, there was no interface with fields in it.