Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bosborne
Level 7

How to pass data to a scene?

I'm unable to pass in data to a scene after I create it. Here's the sample scene component:


<?xml version="1.0" encoding="utf-8" ?>

<component name="SimpleRowListScene" extends="Scene" >

<interface>
<field id="testing" type="string" onChange="testingChanged"/>
</interface>

<script type="text/brightscript" >
<![CDATA[
function init()
print "in main scene init"
end function

function testingChanged() as void
print "hello"
end function
]]>
</script>

<children>
<SimpleRowList id="theRowList" translation="[50,50]" />
</children>
</component>


And here's the code that initializes it (from the main brightscript code, not part of another component):


screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("SimpleRowListScene")
scene.testing = "blah"
screen.show()

while(true)
msg = wait(0, port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed()
return true
end if
end if
end while


When running this code, the text "in main scene init" is printed, but the text "hello" is NOT printed. Why is this? Shouldn't the observer fire?

Ultimately I want to pass in an roArray to the component, which the row list will use to populate itself with.
0 Kudos