Table of Contents


The <component> element defines all aspects of the component defined in a SceneGraph XML component file. Every SceneGraph XML component file must have exactly one <component> element that contains all other XML elements in the file, which may include:

  • an <interface> element that defines the interface fields of the component
  • zero or more <script> elements that define the BrightScript code used by the component
  • a <children> element that contains the child <node> elements (either the built-in node classes or node classes extended from them) for the component, declared in XML markup


The following attributes define a <component> XML element:


Specifies the name of the component, that allows you to create the component in your application. For example, if the name of the component is CastMemberInfo, you could create instances of the component declaratively in a child node element of a component <children> element (<CastMemberInfo/>), or using BrightScript in a <script> element (createObject("roSGNode","CastMemberInfo")).


The name attribute is case-sensitive. You cannot successfully create or declare a component unless the component name exactly matches the name attribute, including case. Also be aware that two components with the exact same name in the same application components directory will have undefined and generally undesirable results if you attempt to create a component object with that name in the application.


Specifies the name of the built-in or extended SceneGraph scene or node class whose functionality is extended by this component. For example, extends="Group" specifies the component has all of the functionality of the Group node class (it can have child nodes, has translation/scale/rotation fields, and so forth).

initialFocusoptionalSpecifies the ID of a node declared in the XML file to have the initial remote control focus when the component is instantiated.
versionoptionalSpecifies the version of the SceneGraph API. The default is 1.0 if not specified.


The following <component> element defines a component named GridPanelExample, that contains <interface>, <script>, and <children> elements.

<component> Element Example
<component name = "GridPanelExample" extends = "GridPanel" initialFocus = "examplePosterGrid" >

  <interface >
    <field id = "gridcontenturi" type = "uri" onChange = "readpostergrid" />

  <script type = "text/brightscript" >


    sub init() = "full" = true = 130 = true = false = false ="examplePosterGrid")
    end sub

    sub readpostergrid()
      m.readPosterGridTask = createObject("roSGNode", "ContentReader")
      m.readPosterGridTask.contenturi =
      m.readPosterGridTask.observeField("content", "showpostergrid")
      m.readPosterGridTask.control = "RUN"
    end sub

    sub showpostergrid() = m.readPosterGridTask.content
    end sub



  <children >

      id = "examplePosterGrid" 
      basePosterSize = "[ 512, 288 ]" 
      caption1NumLines = "1" 
      numColumns = "2" 
      numRows = "2" 
      itemSpacing = "[ 20, 20 ]" />