- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a label in a scene, and I want to access it from main.brs. I've tried assigning it to a global variable:
m.myLabel = m.top.findNode("myLabel")
m.global.myLabel = m.myLabel
Tried this a few ways, but the debugger keeps complaining. I can't assign the label to a global, and so I can't access it in my main function, and so I can't display messages.
The reason I need access to the label it in the main function, that's where the while loop is where messages are checked.
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I know what you're trying to do, but I'm not sure. To access a label in a scene from main.brs, you have to get to it via the scene:
sg = createObject("roSGScreen") scene = sg.createScene("myScene") label = scene.findNode("myLabel")
print label.text ' prints current value
label.text = "New text" ' set label text
-JT
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I know what you're trying to do, but I'm not sure. To access a label in a scene from main.brs, you have to get to it via the scene:
sg = createObject("roSGScreen") scene = sg.createScene("myScene") label = scene.findNode("myLabel")
print label.text ' prints current value
label.text = "New text" ' set label text
-JT
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to create/access a Label in a scene as a global variable? (Displaying messages with roInput)
Yes that was exactly what I was trying to do... thanks!