Can someone please shed some light on an issue I have ....
I know that roUrlTransfer can only be used in a task node, so I created one to turn a json response from a server into a node list, however when the code sets the url it throws an error saying that the roUrlTransfer object is invalid? Anyone have any idea why?
An update to my previous post ... I'm finding that I can't use roUrlTransfer in a task node at all.
The app creates a scene, the scene then loads a group which contains a rowlist and runs a task to create the content for that rowlist by downloading a json and created a contentnode structure from it. I don't see an issue with the logic but the error says "BRIGHTSCRIPT: ERROR: roUrlTransfer: class PLUGIN|MARKUP on thread RENDER: .../components/tasks/ViewContentTask.xml(19)".
I thought the task ran in it's own thread?
This: Function LoadContent() m.LoadTask = CreateObject("roSGNode", "ViewContentTask") m.LoadTask.observeField("content", "ViewContentChanged") m.LoadTask.sourceid = m.top.sourceid m.LoadTask.control = "RUN" End Function is how I'm creating the task so I'm really stuck here with how to get this to work.
After an entire day of experimenting I have a solution, hopefully this will help anyone else that is looking to do this. I hope this makes sense ....
I wanted to pass a parameter to the group node that then passed that into the task so it could download specific content from the server and use it generate content for a rowlist. Specifiying the parameter as an interface field didn't work, it was always empty when the task ran regardless of what I did. Adding the onchange event to the field in the task and using that to trigger the download from the server failed with the error message in my previous post. Very confusing!
So what I've ended up doing is set up my task in a WAIT state and then use an onchange event of the interface field in the group node to set the interface field value in the task and then change the task state to RUN.
"kevxcs" wrote: I thought the task ran in it's own thread?
As you've discovered, only the "functionName" runs in it's own thread, and only when the task is "RUN". "onChange" events always run in the render thread, even when triggered by a task thread.
Your solution looks like the right way to go about what you're trying to do, but "WAIT" isn't a valid value for Task.control, and doesn't actually accomplish anything, so you could get rid of that line.
Thanks for the comments guys 🙂 The transition to Scene Graph is quite confusing at times.
I'm sure I saw WAIT somewhere in an example, maybe I'm just going a little silly from frustration! Thanks for that, so I guess it's in a wait state by default until control is set to run. Slowly getting there although the little hair I have left will be gone by the end of the month.