According to that page, there are two ways of accomplishing the exact same thing:
“You can also use the node.field syntax to get the same result as setField(). That is, rect.setField(“opacity”, 0.5) is equivalent to rect.opacity = 0.5.”
As an unlikely shot in the dark, I tried switching to the other syntax:
scene.extra = m.top.extra
… and viola! The issue was resolved. This seems to be a bug in Roku’s new Firmware (7.7.0.4094)
More info:
Using a Roku 4 (4400)
The scene object was built as follows:
screen = CreateObject("roSGScreen")
scene = screen.CreateScene(m.top.scene)
m.top.scene is a valid string (equal to the name of my scene), and m.top.extra is a valid string:
I tried reproducing as described and could not. setField() worked fine for a scene field - both inside init() and event handler. Can you try providing a minimal code example that demonstrates this? I believe the bug popped out but does not seem as straightforward as described. Is it reliable reproducible or only occasionally?
It happens reliably in that one spot. That is the only spot I’ve used setField() on an roSGScreen. It doesn’t fail on an roSGNode. I am creating a minimal code example and will provide it as soon as I can (our development Roku is currently running a lengthy streaming test).
For that particular spot in my app, I’m calling a Task component from a Scene component:
Then, my launchSceneTask component (extends “Task”) does this:
<component name="launchSceneTask" extends="Task" >
...
sub init()
m.top.functionName = "showSGScene"
end sub
sub showSGScene()
print "in showSGScene"
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene(m.top.scene)
if (m.top.extra <> "") then
print "Packing '" + m.top.extra + "' into 'extra'"
'FAILS:
scene.setField("extra", m.top.extra)
'SUCCEEDS:
'scene.extra = m.top.extra
end if
screen.show()
while(true)
msg = wait(0, m.port)
msgType = type(msg)
if msgType = "roSGScreenEvent" then
if msg.isScreenClosed() then
m.top.open = false
exit while
endif
endif
end while
screen.Close()
end sub
...
</component>
Wait, wat?
Why do you expect to work creation of roSgScreen from a task thread that belongs to anotherroSgScreen? That is a gut-wrenching idea to me and i’d expect it to blow in your face any time - but please correct me if there is information stating otherwise.