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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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" >

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

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

function testingChanged() as void
print "hello"
end function

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

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

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

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