Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Beta Documentation

The contents of this page are subject to change

Various types of content material can be downloaded from your server to a Scene Graph application. Many of the renderable nodes include a uri field that allows you specify the URI of a graphical image file or other content on your server. Setting this field causes the node to automatically download the content to the Scene Graph node, and for graphical images, be rendered on the display screen according the configuration of the node.

For many nodes that require more complex data, a content field is provided. This special field is designed to be assigned the value of a ContentNode node that you configure to contain the data required for the node. The ContentNode node can be configured in a Task node when you want to download the data in the ContentNode node from your server. 

In a Task node, you can use the BrightScript roUrlTransfer component to read the content data from your server. If the data is contained in JSON or XML formats, you can then use the corresponding BrightScript parsing functions and components to configure a ContentNode node with the content data. The BrightScript JSON/XML parsing loop should be set up to terminate when the Task node <interface> field for the target ContentNode node is fully configured with new data, to allow an observeField() function set in the component that requires the data to trigger a callback function to assign the data to the target node.

For example, the following Task node downloads a list of strings to be used as text for a LabelList node. The Task node includes two <interface> fields, one for the URI of the content data (uri), and another for the ContentNode node that will be configured with the data (content). When an XML component requires a list of strings for a LabelList node, the component can set the control field of the Task node object to RUN. This sends the specified <interface> field values to the Task node, in this case the URI of the content data, and starts the Task node. The Task node then downloads an XML file with the content data from the specified URI, parses the XML data, and creates a parent ContentNode node and child ContentNode nodes for each string. When the ContentNode node is configured with all the strings in the XML file, it is assigned to the ContentNode object reference set in the <interface> field. This change in the field value triggers the observeField() callback function in the component XML file to add the strings to the LabelList node content field.

First, here's the XML file the example Task node downloads from the server and parses:

Example Server XML File

And here is how the component XML file configures and starts the Task node process, including setting the observeField() function to trigger a callback function to display the LabelList node after the content data is downloaded:

Example Task Node Configuration and Launch

And here's the actual Task node itself that does the work of downloading the server XML file, parsing the XML content data, and configuring the target ContentNode node:

Downloading LabelList Node Content

Note that this example could be used to download strings for any LabelList node, or for that matter, any node that requires a simple list of strings as the required content for the node. For more complex data requirements, the XML parsing loop in the example could be expanded to include any Content Meta-Data field values required for the node (and of course, contained in the server XML file).


  • No labels