Forum Discussion

philotas's avatar
philotas
Roku Guru
9 years ago

How to manage downloaded data globally? Array or ContentNodes?

On startup I download some data from a server as JSON.

Then I store this data in a global variable so I can access it from anywhere in the Scene Graph.

Now a scene graph might need to download more info from the server for complete rendering.
I also need to create custom lists of the data.

I do not want to have to redownload the data, so I need to write back the fetched data from the thread that fetched the data from server.

When I tried to write back data that was stored in an roAssociativeArray the data was not saved.
First I thought this is due to the data being copied by value not reference, but turns out, it also happened when writing the data directly via the global reference.
Can't a Thread Node modify objects of the global node?
It simply did not work and also did not throw an error.

Now I passed on to use to store the downloaded data in content nodes because this seems to work. 

1) Can a child not be appended to different parents so I can create custom lists (ContentNodes)?
2) Is it a good approach to put everything in ContentNodes after downloading from server or does this impact memory?

Is there any Doc which shows how to handle data globally in general?

thanks!

1 Reply

  • Can you show a small, good example of what and how "does not work"?