<?xml version = "1.0" encoding = "utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->
<component name = "LabelListExample" extends = "Group" initialFocus = "exampleLabelList" >
<script type = "text/brightscript" >
<![CDATA[
sub init()
m.top.backgroundURI = "pkg:/images/rsgde_bg_hd.jpg"
m.programLabel = m.top.findNode("exampleLabelList")
examplerect = m.programLabel.boundingRect()
centerx = (1280 - examplerect.width) / 2
centery = (720 - examplerect.height) / 2
m.programLabel.translation = [ centerx, centery ]
m.top.setFocus(true)
m.getHomeOptionsList = createObject("roSGNode", "getLabelListContent")
m.getHomeOptionsList.observeField("content", "showhomeoptionslist")
m.getHomeOptionsList.functionName = "showhomeoptionslist"
m.getHomeOptionsList.control = "RUN"
end sub
]]>
</script>
<children >
<LabelList id = "exampleLabelList" translation = "[160,92]" itemSize = "[440,48]">
<ContentNode role = "content" >
</ContentNode>
</LabelList>
</children>
</component>
<?xml version = "1.0" encoding = "utf-8" ?>
<!--********** Copyright 2015 Roku Corp. All Rights Reserved. **********-->
<component name = "getLabelListContent" extends = "Task" >
<interface>
<field id = "uri" type = "uri" />
<field id = "content" type = "node" />
</interface>
<script type = "text/brightscript" >
<![CDATA[
sub init()
get_programs()
end sub
sub get_programs()
content = createObject("roSGNode", "ContentNode")
request = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
request.SetMessagePort(port)
print "PARSING JSON"
on_demand_url = "http://www.example/example.json"
request.SetUrl(on_demand_url)
if (request.AsyncGetToString())
while (true)
msg = wait(0, port)
if (type(msg) = "roUrlEvent")
code = msg.GetResponseCode()
if (code = 200)
json = ParseJSON(msg.GetString())
for each program in json.OnDemand.program
print program.name
listitem = content.createChild("ContentNode")
listitem.title = program.name
m.programLabel = listitem
end for
endif
else if (event = invalid)
request.AsyncCancel()
endif
end while
endif
return invalid
End sub
sub showhomeoptionslist()
print "This is the callback function!"
end sub
]]>
</script>
</component>
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in ...:/components/screens/DetailsScreen/ProgramsJSONParser.xml(67)
m.programLabel.content = m.getHomeOptionsList.content
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12, or you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
Thanks for your patience — we’re excited to share what’s next!