Table of Contents
|Table of Contents|
Scene Graph SceneGraph applications can control the flow of screen elements in the following ways:
- by responding to user remote control key press events
- by responding to changes in data, including data that configures the screen elements
- by changing the z-order of screen elements
- by changing the parent-child relationships of screen elements
- by creating and deleting screen elements
- by making screen elements invisible and making other screen elements visible
- by placing remote control focus on screen elements that may be currently off the screen or otherwise not visible
Many of the more complex Scene Graph SceneGraph node classes are designed to automatically respond to remote control key press events, and configure themselves in response to data changes.
Structuring Your Application and Screen Element Components
The Scene Graph SceneGraph API was designed to create components that encapsulate the appearance, behavior, and data of custom screen elements. These custom components can then be used in a Scene node program flow that creates the custom components as needed, in response to user selections, or changes in data received from and/or sent to a server. These custom components are analogous to BrightScript components with data interfaces that render screens and screen elements, such as roPosterScreen; in fact, the Scene Graph SceneGraph PosterGrid node class is itself very similar to the BrightScript component roPosterScreen. But by using the Scene Graph SceneGraph API, you can combine several node classes into a custom component with its own encapsulated behavior in response to user input and data received from your server.
As an example, for typical VOD applications, the following should drive the development of your custom Scene Graph SceneGraph components, and the program flow in the Scene node that displays these components as needed:
To continue with a VOD application example, a typical VOD application will first offer a set of video content categories for user selection, such as "New Releases", "Drama", "Comedy", and so forth. This should drive the development of a Scene Graph SceneGraph custom component that displays these categories, which will read the data from your server that you make available to the component to display the categories, including icons, text, graphic images, in either JSON or XML format. The data provided for that component should also include data to pass to another custom component, through the <interface> element or other means, to allow user selection of further sub-categories or video content items. All of the previous BrightScript component "screens", including "screens" for registration, search, license display, can be developed as encapsulated Scene Graph SceneGraph components, which can (and typically will and should) include their own components developed to provide specific appearance and functionality to several major components in your application.
For the VOD category list example, the first step might be to write a Scene Graph SceneGraph component outline similar to the following:
You can then select the nodes to comprise your custom component from the Scene Graph SceneGraph API node classes, to either create or modify them using BrightScript in the <script> element, and/or declare/define them in XML markup in the <children> element. For example, for a list of categories, you might want to use the LabelList node class, or perhaps the MarkupList node class, since you intend to include graphic images as part of your list. You will also use two Poster node classes somewhere in your component for your icon and poster graphic images, perhaps as part of another custom component that is the definition of the
itemComponentName field of the MarkupList node. You complete the component by adding <interface> element fields as needed to get and set data that is either needed for the component, or passed to other components and/or the Scene node BrightScript program flow.
For the example VOD categories list, we should use a MarkupList node, because we want to use custom graphic images as part of each list item. So we need to start work on a custom item component for the MarkupList node
itemComponentName field. This custom item component is where we will define the individual sub-elements that make up this screen element component, their Scene Graph SceneGraph node type and position, size, and other attributes, and how they will appear as focus moves from item to item. So we start with the following outline:
These examples download and convert a MRSS XML feed containing all the data for the application to a ContentNode node field added to the Scene node <interface> element. In this case, the data for the application is downloaded and converted in the
source/main.brs file after the application Scene node is created but before it is shown, rather than using a Task node in the actual Scene Graph SceneGraph application.