Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gsarath
Level 7

How to access the roSGScreen Object inside the Scene Graph Components

Is there a way how we can access the roSGScreen Object inside the Scene Graph Components.

Below mentioned is the code in Brightscript main.brs
sub Main()

    screen = CreateObject("roSGScreen")
    port = CreateObject("roMessagePort")
    screen.setMessagePort(port)

    m.scene = screen.CreateScene("VideoScene")
    screen.show()
     
    while(true)
        msg = wait(0, port)
        if type(msg) = "roSGScreenEvent"
            if msg.isScreenClosed() then return
        end if
    end while
end sub


VideoScene.xml
<?xml version="1.0" encoding="utf-8" ?>

<component name="VideoScene" extends="Scene">

<script type="text/brightscript" uri="pkg:/components/VideoScene.brs" />
</component>


VideoScene.brs
function init()

end function


Is there a way how we can get the roSGScreen object from the scene object inside VideoScene.brs similar to screen.GetScene()  which returns the roSGScene object associated with the screen.
0 Kudos
2 REPLIES 2
EnTerr
Level 11

Re: How to access the roSGScreen Object inside the Scene Graph Components

I can think of couple of ways to pass roSgScreen into the scene - but why? 
why would you want to do such a thing?!
0 Kudos
TheEndless
Level 10

Re: How to access the roSGScreen Object inside the Scene Graph Components

I second EnTerr's question.  You can walk up the getParent() tree to get to the Scene from a component, but why would you ever need to get access to the roSGScreen?
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