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: 
cfapple
Visitor

Getting external data into scene graph

Somewhere down the line I missed the basics on the scene graph usage. I've tried two approaches for getting access to data from outside of the application into a custom scene graph element and failed both times. In the first case I used a lightly modified version of ParseXMLContent() from the "Simple Grid and Video" to push the data into content nodes. The problem I had was that the following code


production = createObject("RoSGNode","ContentNode")

...

'production["Text"] = "text" 'works
'production.temp = "temp" 'Doesn't work?
'production.title = "title" 'Does work
'production["Labeltext"] = data.series[series].title 'doesn't work
print production


Trying variations of the above didn't allow me to set what I wanted, yet the sample provided was able to copy key pairs from an array without issue. Is there a limitation in using content nodes I'm missing here?

The second thing I tried was to bypass the above issue altogether by having the custom element pull the data I needed directly within the init() call, but attempting to call SetUrl() on a roUrlTransfer object would throw an error and using ReadAsciiFile() fails even if I successfully store and read the file before creating the scene. Is it not possible to directly access the data in the components like this?

I'm sorry for having to ask about such basic stuff like this, but I've hit a point where I don't even know which part of the docs to read anymore.
0 Kudos
2 REPLIES 2
TheEndless
Channel Surfer

Re: Getting external data into scene graph

"cfapple" wrote:
Trying variations of the above didn't allow me to set what I wanted, yet the sample provided was able to copy key pairs from an array without issue. Is there a limitation in using content nodes I'm missing here?

ContentNodes only support fields defined in the Content Metadata section of the documentation (that's why Text and Title both work, but Temp and LabelText don't). If you need custom fields, then you'll need to create a custom component that extends ContentNode, then add your own interface fields.
"cfapple" wrote:
The second thing I tried was to bypass the above issue altogether by having the custom element pull the data I needed directly within the init() call, but attempting to call SetUrl() on a roUrlTransfer object would throw an error and using ReadAsciiFile() fails even if I successfully store and read the file before creating the scene. Is it not possible to directly access the data in the components like this?

roUrlTransfer and ReadAsciiFile are only available within a Task node. They cannot be used in the main SceneGraph render thread.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
cfapple
Visitor

Re: Getting external data into scene graph

Yeah, I feel pretty dumb right now. Thanks for the links! I also went digging through the docs with a clear head this morning and also found this page on Scene Graph BrightScript Support that even puts it in bold.
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.