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: 
Kei19
Newbie

Having problem with RowList display

Hi, I'm new to Brightscript so I created my own view and logic for practice. I created example view with RowList but for some reason nothing display on the scene. I testing if my main scene is appear and everything working fine but RowList never display. Here is my code

Main

<interface>
        <field id="content" type="node" alias="rowlist.content"/>
    </interface>
    <children>
        <RowList
            itemComponentName="ExampleList"
            id="rowlist"
            translation="[80,350]"
            numRows="1"
            rowitemSize="[[320,180]]"
            rowItemSpacing="[[20,0]]"
            itemSize="[1100,270]"
            rowLabelOffset="[[50,20]]"
            focusXOffset="[50]"
            showRowLabel="[true]"
            rowFocusAnimationStyle="floatingfocus"
        />
    </children>

Main brs file

function init() as void
    loadFeed()
    m.rowlist = m.top.findNode("rowlist")
    m.rowlist.observeField("rowItemFocused", "onItemFocused")
end function
function loadFeed() as void
    m.contentTask = CreateObject("roSGNode", "MainLoader")
    m.contentTask.observeField("content", "onFeedResponse")
    m.contentTask.control = "RUN"
end function
function onFeedResponse() as void
    m.rowlist.content = m.contentTask.content
    m.rowlist.setFocus(true)
end function

Example List xml

<interface>
        <field id="contentData" type="node" onChange="getContentData"/>
    </interface>
    <children>
        <Poster id="ExamplePoster" width="320" height="180" loadDisplayMode="scaleToFit"/>
        <Label id="ExampleTitle" width="320" size="60" horizAlign="right"/> 
    </children>

Main Loader Task brs

function init() as void
    m.top.functionName = "LoadContent"
end function

function LoadContent() as void
    port = createObject("roMessagePort")
    getUrl = CreateObject("roURLTransfer")
    getUrl.RetainBodyOnError(true)
    getUrl.setPort(port)
    getUrl.SetUrl("https://gist.githubusercontent.com/saniyusuf/406b843afdfb9c6a86e25753fe2761f4/raw/523c324c7fcc36efab8224f9ebb7556c09b69a14/Film.JSON")
    getUrl.SetCertificatesFile("common:/certs/ca-bundle.crt")
    getUrl.InitClientCertificates()
    response = getUrl.getToString()
    json = ParseJson(response)
    if (getUrl.AsyncGetToString())
        msg = wait(10000, port)
        if (type(msg) = "roUrlEvent")
            if(msg.getresponsecode() > 0)
                if (json <> invalid)
                    row = []
                    contentNode = CreateObject("roSGNode", "ContentNode")
                    for each item in json
                        node = createObject("roSGNode", "ContentNode")
                        node.Title = item.Title
                        node.HDPOSTERURL = item.Poster
                        node.description = node.Plot
                        node.id = item.imdbID
                        contentNode.AppendChild(node)
                    end for
                    m.top.content = contentNode
                end if
            else
                ? "load failed: " msg.getfailurereason()
                ? "response code: " msg.getresponsecode()
            end if
        else if (msg = invalid)
            ? "load failed"
        end if     
    end if
end function
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.