Forum Discussion

destruk's avatar
destruk
Streaming Star
9 years ago

Scenegraph Layout simplification?

For ease of editing, is it at all possible to have your main/brs source file that starts and exits scenegraph mode, and to simply have a single component to run the entire channel?  So the main.brs, a component folder, and within thatfolder have a single brs script and single xml file with all the screens nested in a total of 3 files?
Or is there some specific reason that every little thing needs a brs and xml file - for 10-20 separate component subfolders?

Alternately, is it possible to have multiple components specified in a single xml file?
  • You can have as many files as you please or as few as your app needs allow.

    1. There is no need to do subfolders and that's likely counterproductive.

    2. You need one XML file per each custom component - that is necessary when modifying built-in behavior, e.g. to define `onKeyEvent()` handler for it or observer event handlers. Currently there is no way to create custom component w/o XML file - though minor things like adding or observing fields can be done from "outside" (another component/thread), using a "stock" component (no need to create custom)

    3. You don't need one BRS file per custom component, though that often is practical. Instead you could ostensibly include the brs code inside the xml. .brs files don't have to reside in the same folder, since you have to provide explicit URI anyway. And you can use more than one .brs per component (e.g. the same file included in multiple places like a library; but don't get carried away).
  • destruk's avatar
    destruk
    Streaming Star
    Thanks RokuNB!  It looks like a much smarter system so I'll need to run some experiments with structure to find one I can more easily work with.