obj = createObject("roSGNode", "Node")
child = createObject("roSGNode", "ContentNode")
child.id = "foo"
obj.appendChild(child)
print obj.findNode("foo") ' This returns Invalid
Brightscript Debugger> obj = createObject("roSGNode", "Node")
child = createObject("roSGNode", "ContentNode")
child.id = "foo"
obj.appendChild(child)
print obj.findNode("foo") ' This returns Invalid
Brightscript Debugger>
Brightscript Debugger>
Brightscript Debugger>
Brightscript Debugger> <Component: roSGNode> =
{
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id: "foo"
}
obj = createObject("roSGNode", "Node")
child = createObject("roSGNode", "ContentNode")
child.id = "foo"
obj.appendChild(child)
print obj.findNode("foo")
' invalid '
print obj.getChildCount()
' 1 '
print obj.getChild(0)
' <Component: roSGNode> = '
' { '
' change: <Component: roAssociativeArray> '
' focusable: false '
' focusedChild: <Component: roInvalid> '
' id: "foo" '
' } '
obj = createObject("roSGNode", "Node")
child = obj.createChild("ContentNode")
child.id = "foo"
print obj.findNode("foo")
print obj.getChildCount()
print obj.getChild(0)
obj = m.top.createChild("Node")
child = createObject("roSGNode", "ContentNode")
child.id = "foo"
obj.appendChild(child)
print obj.findNode("foo")
' <Component: roSGNode> = '
' { '
' change: <Component: roAssociativeArray> '
' focusable: false '
' focusedChild: <Component: roInvalid> '
' id: "foo" '
' } '
print obj.getChildCount()
' 1 '
print obj.getChild(0)
' <Component: roSGNode> = '
' { '
' change: <Component: roAssociativeArray> '
' focusable: false '
' focusedChild: <Component: roInvalid> '
' id: "foo" '
' } '
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("Main")
screen.show()
Sub Main(args)
m.screen = CreateObject("roSGScreen")
m.screen.setMessagePort(Legacy().getMessagePort())
m.scene = m.screen.CreateScene("MainScene")
m.screen.show()
obj = createObject("roSGNode", "Node")
child = createObject("roSGNode", "ContentNode")
child.id = "foo"
obj.appendChild(child)
print obj.findNode("foo")
obj = m.top.createChild("Node")
"RokuNB" wrote:
@ChrisDP - model#? firmware#?
which thread are you trying findNode() in? (render thread, task thread, main() thread)
Brightscript Debugger> node = CreateObject("roSGNode", "ContentNode")
Brightscript Debugger> child = CreateObject("roSGNode", "ContentNode")
Brightscript Debugger> child.id = "aaa"
Brightscript Debugger> node.appendChild(child)
Brightscript Debugger> ?node.findNode("aaa")
invalid
Brightscript Debugger> ?node.getChild(0)
<Component: roSGNode:ContentNode> =
{
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id: "aaa"
}
Brightscript Debugger> m.top.appendChild(node)
Brightscript Debugger> m.top.removeChild(node)
Brightscript Debugger> ?node.findNode("aaa")
<Component: roSGNode:ContentNode> =
{
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id: "aaa"
}
"bird3214" wrote:
It seems that pointer to child element is not set correctly before node is appended to m.top. Attaching and detaching node fixes the pointer, but it should work out of box.