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

Re: Hold Array Value

EDIT:
I have found that if I incorporate the code from the Function HoldIndex(index) (shown below) into the Function Channelloop, the array stays populated and passes. I really don't know why this is but it works by eliminating a function. Thanks to all who have looked over and given help.

Sorry left off some endifs
Sub RunUserInterface()
o = setup()
o.setup()
o.GetData()
o.channelloop()
End Sub

Function GetData() AS OBJECT
facade = CreateObject("roOneLineDialog")
facade.SetTitle("Retrieving Program Information. . .")
facade.ShowBusyAnimation()
facade.Show()
xmlxfer=CreateObject("roUrlTransfer")
xmlport=CreateObject("roMessagePort")
xmlxfer.SetMessagePort(xmlport)
tvguide="http://xxx.xxx.x.xx:xxxxx/myfile.xml"
xmlxfer.SetUrl(myfile)
response=xmlxfer.GetToFile("tmp:/status.temp3")
readxml=ReadAsciiFile("tmp:/status.temp3")
xml = CreateObject("roXMLElement")
IF xml.Parse(readxml)
?"XML PARASED. . ."
programinfo=[]
programlist=[]
For i= 0 to xml.programme.count()-1
programinfo={
date: xml.programme[i]@start,
time: xml.programme[i]@start,
title: xml.programme[i].title.gettext()
channel: xml.programme[i]@channel 'GET CHANNEL
}
?"SHOW DATE. .."programinfo.date
?"SHOW TIME. . ."programinfo.time
?"SHOW TITLE. . ."programinfo.title
?"SHOW CHANNEL. . ."programinfo.channel
m.programlist.Push(programinfo)
End For
?"PROGRAMLIST CREATED. . ."
?"PROGRAMLIST COUNT. . ."m.programlist.count()
else
?"DIDN'T PASS. . ."
END IF

End Function
Function ChannelLoop() as object

index=0
while true
msg = wait(0, m.port)
if msg <> invalid
if (msg.isRemoteKeyPressed())
id = msg.GetIndex()
if id=2
programinfo=HoldIndex(index)
'?"PROGRAMIFNO. . ."programinfo.count()
endif
endif
endif
end while
End Function



FUNCTION HoldIndex(index)
?"HOLDINDEX PROGRAMLIST COUNT. . ." m.programlist.count()
return m.programlist
end function
0 Kudos
RokuMarkn
Visitor

Re: Hold Array Value

Ok, without seeing the code I was about to guess that this was the problem. You are calling ChannelLoop via an AssociativeArray. Therefore the "m" variable in that function refers to the AA, not to the global "m" variable.

--Mark
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.