Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Beta Scene Graph Components

I'm in a row list screen, and I have 3 row list elements. When i select one of them, i create a new scene that extends the task node that will download and parse a xml file. I am able to create a new screen , create my scene, but when i try to append any content to my scene, roku freezes, the telnet connection is lost, and then roku restarts itself . Suppose for the purpose of this example that when i select first element from the row i want to insert a rectangle such as <Rectangle id="middleRectangle" color="0xFFFFFF" width="50" height="50" translation="[250,225]"/> or when i select the second element i want to insert something as a label

function createContentTest(xml) as void
contentNode = createObject("roSGNode","ContentNode")
for each elem in xml
print elem.getName()
child = contentNode.createChild(elem.getName())
child.setFields(elem.getAttributes())
end for
screen = createObject("roSGScreen")
port = createObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.createScene("seletedItemScene")
scene.appendChild(contentNode)

end function


####### selectedItemScene ####

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

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

<children>
<Label text="aaa" translation="[0,0]" />
</children>

</component>
0 Kudos

Re: Beta Scene Graph Components

I'm trying to create a "roArray" object in my scenegraph init function, and i get invalid as a result. It is not possible ? This component is not listed in Scene Graph BrightScript Support table.
0 Kudos

Re: Beta Scene Graph Components

Can we change the colour of the RowList cursor?
I've noticed by default it's bright white... but the client would like to have it on blue colour.
0 Kudos

Re: Beta Scene Graph Components

How to set a field outside the xml file?

I want to send a value when I create a scene in main function:
sub Main()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("FirstScene")
scene.url = "http://wallpaperswide.com/download/" 'HERE I want to send the url value
'in debugging mode scene.url or scene.top.url are both invalid here
screen.show()
end sub


I have this xml with "FirstScene" Scene:
<?xml version="1.0" encoding="utf-8" ?> 
<component name="FirstScene" extends="Scene" >
<interface>
<field id="url" type="string"/>
</interface>
<script type="text/brightscript">
<![CDATA[
sub init()
m.ep1 = m.top.createChild("Poster")
m.ep1.uri = m.top.url 'HERE I want to use the url
'But when I debug the app, in terminal the m.top.url field has no value
m.ep1.width = "264"
m.ep1.height = "148"
m.ep1.translation = "[930,500]"
end sub
]]>
</script>
</component>
0 Kudos

Re: Beta Scene Graph Components

Regarding what Maria said, a field from a component interface can be set only in the init function of that component or in other components init function ? Is there a way for setting a field like she is doing in the example ? If not, how can we solve this problem?
0 Kudos
neptor
Visitor

Re: Beta Scene Graph Components

this gona help to make videogames?
0 Kudos
Komag
Roku Guru

Re: Beta Scene Graph Components

nope.
0 Kudos
jul10
Visitor

Re: Beta Scene Graph Components

"maria_tarkany" wrote:
How to set a field outside the xml file?

I want to send a value when I create a scene in main function:
sub Main()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("FirstScene")
scene.url = "http://wallpaperswide.com/download/" 'HERE I want to send the url value
'in debugging mode scene.url or scene.top.url are both invalid here
screen.show()
end sub


I have this xml with "FirstScene" Scene:
<?xml version="1.0" encoding="utf-8" ?> 
<component name="FirstScene" extends="Scene" >
<interface>
<field id="url" type="string"/>
</interface>
<script type="text/brightscript">
<![CDATA[
sub init()
m.ep1 = m.top.createChild("Poster")
m.ep1.uri = m.top.url 'HERE I want to use the url
'But when I debug the app, in terminal the m.top.url field has no value
m.ep1.width = "264"
m.ep1.height = "148"
m.ep1.translation = "[930,500]"
end sub
]]>
</script>
</component>


In order to make this work you'll need to have an observer set up on the 'url' field in your scene.

So your init() in your FirstScene would look like this:


sub init()
m.ep1 = m.top.createChild("Poster")
m.ep1.width = "264"
m.ep1.height = "148"
m.ep1.translation = "[930,500]"

m.top.observeField("url", "onUrlChanged")
end sub

sub onUrlChanged()
m.ep1.uri = m.top.url
end sub


The rest should remain unchanged.

Edit: Actually, you also need to assign the scene variables after calling screen.show() in your main()
0 Kudos
sudo97
Visitor

Re: Beta Scene Graph Components

Hello, in roVideoScreen or roVideoPlayer we had maxBandwidth field and Streams field, so we could tune onto stream with quality we want. But in Scene Graph when I create the same thing:
			m.video = m.top.FindNode("VideoPlayer")
videoContent = CreateObject("roSGNode", "ContentNode")
videoContent.Streams = [{
url: "link1",
bitrate: 1975,
quality: false,
contentid: "aaa"},
{
url: "link2",
bitrate: 921,
quality: false,
contentid: "bbb"}]
m.video.content = videoContent
m.video.ObserveField("errorMsg", "Error")
m.video.control = "play"
end sub

sub Error()
print m.video.errorMsg
end sub



I recieve a "failed to create media player", so my question is how can I do the same things in Scene Graph as I used to do with roVideoPlayer, using maxBandwidth?
0 Kudos
aloudmind
Visitor

Re: Beta Scene Graph Components

Is there a way to have http://sdkdocs.roku.com/display/sdkdoc/RowList scroll up and down as opposed to left and right?
0 Kudos