Forum Discussion
norcaljohnny
8 years agoRoku Guru
What type of content is it? XML, JSON ?
I will wait around for another 15 mins or so and see if you respond.
In case I miss you here is one way and forgive me but I like to use a more standardized code if you will.
contentreader.xml
the.xml
I will wait around for another 15 mins or so and see if you respond.
In case I miss you here is one way and forgive me but I like to use a more standardized code if you will.
contentreader.xml
<?xml version = "1.0" encoding = "utf-8" ?>
<component name = "ContentReader" extends = "Task" >
<interface>
<field id = "contenturi" type = "uri" />
<field id = "content" type = "node" />
</interface>
<script type = "text/brightscript" >
<![CDATA[
sub init()
m.top.functionName = "getcontent"
end sub
sub getcontent()
content = createObject("roSGNode", "ContentNode")
contentxml = createObject("roXMLElement")
readInternet = createObject("roUrlTransfer")
readInternet.setUrl(m.top.contenturi)
contentxml.parse(readInternet.GetToString())
if contentxml.getName()="Content"
for each item in contentxml.GetNamedElements("item")
itemcontent = content.createChild("ContentNode")
itemcontent.setFields(item.getAttributes())
end for
end if
m.top.content = content
end sub
]]>
</script>
</component>
the.xml
<component name = "SimplePosterGrid" extends = "Scene" initialFocus = "postergrid" >
<interface>
<field id="itemContent" type="node" onChange="showpostergrid"/>
</interface>
<script type = "text/brightscript" >
<![CDATA[
sub init()
m.postergrid = m.top.findNode("PosterGrid")
m.readPosterGridTask = createObject("roSGNode", "ContentReader")
m.readPosterGridTask.contenturi = "http://yourfilehere.xml"
m.readPosterGridTask.observeField("content", "showpostergrid")
m.readPosterGridTask.control = "RUN"
end sub
sub showpostergrid()
m.postergrid.content = m.readPosterGridTask.content
m.postergrid.setFocus(true)
end sub
]]>
</script>
<children>
<PosterGrid
id = "PosterGrid"
basePosterSize = "[ 375, 225 ]"
numColumns = "4"
numRows = "3"
itemSpacing = "[ 50, 75 ]" />
</children>
</component>