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

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.

add an interface field to your child (trial) node.

<interface>
    <field id="watchThis" type="boolean" value="false"/>
</interface>

observe the interface field from the parent node

m.trial.observeField("watchThis", "doSomething")

sub doSomething()
    'Remove child node'
    m.top.removeChild(m.trial)
end sub

when your button is clicked in the child, set the field to true in the child component,

function submit()
    m.top.watchThis = true
end function

It worked ! Thank you so much.