Forum Discussion
NB_
7 years agoRoku Guru
"sdpetersen" wrote:
I've read bits in the Roku documentation that suggest that m.top.movieContent and m.top.findNode("movieContent") are synonymous, however I'm finding that's not true, at least not in terms of scope of the variable.
No, they are not synonymous.
m.top.movieContent accesses attribute/field of the current custom/xml component.
m.top.findNode("movieContent") searches recursively for a node by given ID attribute.
First, can you help me find a way of assigning dynamic variables that I can access outside of the function?
Use task's m.top for that. Use `m` to store tasks variables and `m.top` for dealing with external threads. I'd
- add 2 fields, m.top.addFields({inbox: {}, outbox: {}})
- m.top.observerField("inbox", somePort)
- run a message loop waiting for commands getting sent (by assigning) to `inbox`
- do the job and assign the result to `outbox`
- externally, another thread is observing `outbox` and on result arrival, do what it wanted to