brightscript - Roku SceneGraph TargetList last child animates incorrectly -
i running issue targetlist component provided roku scenegraph. targetlist's last child not animating correctly. on animation, last child turns different color. here clip of looks like. https://photos.google.com/share/af1qipmeeorvq9rs3tc0swuhmbqoaxrpogzk2dimvhdflpw7q1dw8hxchvg8spw6efov1a?key=cucytw9pvvlbemhvsjhjwuthdxhkedftagjtt1vn
it doing last child in list. have tried 3 , 4 child list, same outcome.
here targetlist xml:
<?xml version="1.0" encoding="utf-8"?> <component name="rowt2targetgroup" extends="targetlist"> <interface> </interface> <script type="text/brightscript" > <![cdata[ function init() m.top.observefield("focusedchild", "focusedchildchanged") m.top.observefield("itemfocused", "itemfocusedchanged") m.top.observefield("itemunfocused", "itemunfocusedchanged") m.top.defaulttargetsetfocusindex = 0 m.top.advancekey = "right" m.top.reversekey = "left" m.top.wrap = false m.top.itemcomponentname = "simpleitemcomponent" targetset1 = createobject("rosgnode", "targetset") targetset1.focusindex = 0 targetset1.targetrects = [ { x:50, y:2, width:594, height:333 }, { x:650, y:10, width:566, height:318 } ] targetset2 = createobject("rosgnode", "targetset") targetset2.focusindex = 1 targetset2.targetrects = [ { x:64, y:10, width:566, height:318 }, { x:636, y:2, width:594, height:333 } ] m.top.focusedtargetset = [targetset1,targetset2] unfocusedtargetset = createobject("rosgnode", "targetset") unfocusedtargetset.targetrects = [ { x:64, y:10, width:566, height:318 }, { x:650, y:10, width:566, height:318 } ] m.top.unfocusedtargetset = unfocusedtargetset m.top.targetset = m.top.focusedtargetset[0] m.top.showtargetrects = true end function function itemfocusedchanged() print "itemfocused changed to: "; m.top.itemfocused end function function itemunfocusedchanged() print "itemunfocused changed to: "; m.top.itemunfocused end function ]]> </script> <children> </children> </component>
here how declared:
sub init() '... stuff here m.row = createobject("rosgnode", "rowt2targetgroup") m.row.content = setupdatamodel(2) m.top.appendchild(m.row) '... stuff here end sub function setupdatamodel(maxcount) contentroot = createobject("rosgnode", "contentnode") = 0 maxcount-1 child = contentroot.createchild("contentnode") child.title = "item " + i.tostr() end return contentroot end function
here itemcomponentname class:
<?xml version="1.0" encoding="utf-8" ?> <component name="simpleitemcomponent" extends="group" > <!-- note target , rect both set during interpolation --> <interface> <field id="index" type="int" /> <field id="grouphasfocus" type="boolean" onchange="focuspercentchanged"/> <field id="itemcontent" type="node" onchange="itemcontentchanged" /> <field id="currtarget" type="float" onchange="currtargetchanged" /> <field id="currrect" type="rect2d" onchange="currrectchanged" /> <field id="focuspercent" type="float" onchange="focuspercentchanged" /> </interface> <script type="text/brightscript" > <![cdata[ function init() m.therect = m.top.findnode("therect") m.thelabel = m.top.findnode("thelabel") end function function itemcontentchanged() ?"itemcontentchanged" m.thelabel.text = m.top.itemcontent.title end function function currrectchanged() m.therect.width = m.top.currrect.width m.therect.height = m.top.currrect.height end function function focuspercentchanged() if (m.top.grouphasfocus) 'm.focuscolorinterp.fraction = m.top.focuspercent else 'm.focuscolorinterp.fraction = 0 end if end function ]]> </script> <children> <rectangle id="therect" color="0xff0000"> <label id="thelabel" translation="[10, 10]" /> </rectangle> </children> </component>
Comments
Post a Comment