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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Binge Watcher

BRIGHTSCRIPT: ERROR: roSGNode.AddReplace: "url": Type mismatch: pkg:/components/home_scene.brs(62) f

I want to add timer to load my JSON file after every 5 sec but i'm getting this error. This is my code for selected category.

function loadFeed(url)
    ? "Change every 5 sec"
    ? "URL"url
    m.feed_task = CreateObject("roSGNode", "load_feed_task")
    m.feed_task.observeField("response", "onFeedResponse")

    m.feed_task.url = url
    m.feed_task.control = "RUN"
end function
function onFeedResponse(obj)
    response = obj.getData()
    ' turn the JSON string into an Associative Array
    fetch = ParseJson(response)
    tempStrechData = CreateObject("roArray", 0, true){ strechedData: [] })
    if fetch <> invalid and <> invalid
        ' hide the category screen and show content screen
        m.category_screen.visible = false
        m.content_screen.visible = true
        ' assign data to content screen
        m.content_screen.feed_data = fetch

        ? tempStrechData = tempStrechData
    end if
end function


sub onCategorySelected(obj)
    ? "onCategorySelected field: "; obj.getField()
    ? "onCategorySelected data: "; obj.getData()
    list = m.category_screen.findNode("category_list")
    ? "onCategorySelected checkedItem: "; list.checkedItem
    ? "onCategorySelected selected ContentNode: "; list.content.getChild(obj.getData())
    item = list.content.getChild(obj.getData())"url", "string", false)
    url = item.feed_url
    ' code for timer
    m.testtimer ="testTimer")
    m.testtimer.control = "start"

    m.textchange = false

    m.testtimer.ObserveField("fire", "loadFeed")
' code for timer
    ' loadFeed(url)

    ' loadFeed(item.feed_url)
end sub
0 Kudos