Nethram
8 years agoVisitor
Roku scene graph - How to send data from roSGnode to parent.
Hi,
In my app I have a trial button,a signin button and a signup button in scene that created from "main.brs" .When trial button clicked , it will create roSGnode as follows.
sub init
m.trial= m.top.findNode("trial")
m.trial.ObserveField("buttonSelected", "startsignup")
end sub
function startsignup()
m.firstpage.visible= false
m.subscription = createObject("roSGNode","Subscription")
m.top.appendChild(m.subscription)
m.subscription.setFocus(true)
end function
The created roSGnode has a button group with two buttons.
Subscription.xml
<component name = "Subscription" extends = "Group" initialFocus="fullcontent">
<children >
<Group>
<ButtonGroup id="submit"
layoutDirection = "horiz"
translation = "[ 500,600]"
/>
</Group>
</children>
</component>
Subscription.brs
sub init()
m.buttongroup = m.top.findNode("submit")
m.buttongroup.buttons = [ "DECLINE", "ACCEPT" ]
m.buttongroup.ObserveField("buttonSelected","submit")
end sub
function submit()
if m.buttongroup.buttonSelected = 1 then
m.accepted = createObject("roSGNode","Accepted")
m.top.appendChild(m.accepted)
m.accepted.setFocus(true)
else
?"Back to home scene"
end if
end function
I want to send a notification from the child to home scene and remove the child when user clicks the "cancel" button.
please help me to solve this problem.
In my app I have a trial button,a signin button and a signup button in scene that created from "main.brs" .When trial button clicked , it will create roSGnode as follows.
sub init
m.trial= m.top.findNode("trial")
m.trial.ObserveField("buttonSelected", "startsignup")
end sub
function startsignup()
m.firstpage.visible= false
m.subscription = createObject("roSGNode","Subscription")
m.top.appendChild(m.subscription)
m.subscription.setFocus(true)
end function
The created roSGnode has a button group with two buttons.
Subscription.xml
<component name = "Subscription" extends = "Group" initialFocus="fullcontent">
<children >
<Group>
<ButtonGroup id="submit"
layoutDirection = "horiz"
translation = "[ 500,600]"
/>
</Group>
</children>
</component>
Subscription.brs
sub init()
m.buttongroup = m.top.findNode("submit")
m.buttongroup.buttons = [ "DECLINE", "ACCEPT" ]
m.buttongroup.ObserveField("buttonSelected","submit")
end sub
function submit()
if m.buttongroup.buttonSelected = 1 then
m.accepted = createObject("roSGNode","Accepted")
m.top.appendChild(m.accepted)
m.accepted.setFocus(true)
else
?"Back to home scene"
end if
end function
I want to send a notification from the child to home scene and remove the child when user clicks the "cancel" button.
please help me to solve this problem.