<?xml version="1.0" encoding="utf-8" ?>
<component name="rokuMenu" extends="Group" >
<script type = "text/brightscript" >
<![CDATA[
sub init()
print "Roku Menu Screen"
m.example = m.top.findNode("exampleLabelList")
' m.labellist=m.top.findNode("testPoster")
m.labeltype=m.top.findNode("lableType")
m.assoarray={}
m.arr=""
m.itemsIndex=0
m.items=["Manish","Manish1","Manish2"]
examplerect = m.example.boundingRect()
centerx = (1280 - examplerect.width) / 2
centery = (720 - examplerect.height) / 2
m.example.translation = [ 900, 200 ]
m.example.setFocus(true)
end sub
'##############################################################
sub getContent()
print "getContent"
print "##############################################################"
print m.api.content
print m.api.content.metadata
m.example.content=m.api.content
end sub
'##############################################################
sub getArray()
print "get Array"
value=ParseJSON(m.api.dataArray)
m.arr=value.items
print value
m.example.observeField("itemFocused", "itemSelected")
end sub
'##############################################################
sub itemSelected()
print "get Array"
value=ParseJSON(m.api.dataArray)
print "It worked"
print m.example.itemFocused
' m.labellist.uri=value.items[m.example.itemFocused].icon
end sub
'##############################################################
function onKeyEvent(key as String, bPressed as Boolean) as Boolean
print key
print "roku menu brs on key event"
if key="right" AND bPressed=true
if m.itemsIndex<>m.top.contentListData.Count()
m.labeltype.text= m.top.contentListData[m.itemsIndex].title
m.itemsIndex=m.itemsIndex+1
end if
else if key="left" AND bPressed=true
if m.itemsIndex>0
m.itemsIndex=m.itemsIndex-1
m.labeltype.text= m.top.contentListData[m.itemsIndex].title
end if
else if key="OK" AND bPressed=true
print m.top.contentListData[m.itemsIndex].title
print m.top.contentListData[m.itemsIndex].channelname
m.newTask=createObject("roSGNode", "ChannelListTask")
m.newTask.channelId=m.top.contentListData[m.itemsIndex].channelname
m.newTask.contenturi="http://vortexlive.dyndns.tv:88/RokuAPI/GetChannel.php?user=testroku&password=test2016&category="
m.newTask.observeField("content", "getContent")
m.newTask.observeField("dataArray","getArray")
m.newTask.control="RUN"
end if
end function
'##############################################################
function doSomething()
m.api=createObject("roSGNode", "ChannelListTask")
m.labeltype.text= m.top.contentListData[m.itemsIndex].title
refreshList(m.top.contentListData[m.itemsIndex].channelname)
end function
function getContent1()
print "1 sdsdasdasd as d a sd a sd a sd sda"
end function
function getArray1()
print "2 sdsdasdasd as d a sd a sd a sd sda"
end function
function refreshList(channelValue)
m.api.channelId=channelValue
m.api.contenturi="http://vortexlive.dyndns.tv:88/RokuAPI/GetChannel.php?user=testroku&password=test2016&category="
m.api.observeField("content", "getContent")
m.api.observeField("dataArray","getArray")
m.api.control="RUN"
end function
]]>
</script>
<interface>
<field id = "run" type ="string" alwaysNotify="true" onChange="doSomething" />
<field id = "contentListData" type ="array" alwaysNotify="true"/>
</interface>
<children >
<Overhang id="appOverhang"
color="#000000"
></Overhang>
<LabelList id = "exampleLabelList" >
</LabelList>
<label id="lableType" translation="[900,150]"></label>
<Poster
id="leftPoster"
uri="pkg:/images/left.png"
width="40"
height="40"
translation="[850,140]" />
<Poster
id="rightPoster"
uri="pkg:/images/right.png"
width="40"
height="40"
translation="[1175,140]" />
<!--<Poster-->
<!--id="testPoster"-->
<!--uri="pkg:/images/loader.png"-->
<!--width="0.0"-->
<!--height="0.0"-->
<!--loadSync="true"-->
<!--translation="[900,200]" />-->
</children>
</component>
Using web services i change the content of labellist but their is issue labellist updates on one time later on the value changed doesn't reflect.