Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 9

refresh scrollabletext

Hi

I've looked and tried to achieve this but no go.

Here's what I'm trying to do. After a user moves the text within a scrollabletext node via the remote inputs and another event occurs (eg. a timeout from a timer control), I want the text to refresh back so that the beginning of the text is back at the top. I understand I could destroy the node and recreate the node so it will reinitialize. Is this the only way or am I missing something?

TIA

0 Kudos
1 Reply
Highlighted

Re: refresh scrollabletext

Hello,

 

I'm sorry to be a bit late but my solution was to delete and create again the scrollabletext. Here is my sample:

 

sub init()
m.description = m.top.findNode("description")
m.top.observeField("visible", "setScrollbarThumbBitmapUri")
' my component logic
end sub


sub setScrollbarThumbBitmapUri()
	if m.top.visible
		m.description.scrollbarThumbBitmapUri = "pkg:/images/scroll/scrollbarThumbBitmapUriFocus.9.png"
	else
		m.description.scrollbarThumbBitmapUri = "pkg:/images/scroll/scrollbarThumbBitmapUri.9.png"
	end if
resetScrollText()
end sub

sub resetScrollText()
	m.top.removeChild(m.description)
	m.description = createObject("roSGNode", "ScrollableText")
	m.description.font.size = 20
	m.description.font.uri = "pkg:/source/NanumGothic/NanumGothic-Regular.ttf"
	m.description.id = "description" 
	m.description.translation = [270,262]
	m.description.color = "0xFFFFFF" 
	m.description.visible = true 
	m.description.width = 740
	m.description.height = 380
	m.description.text = "" 
	m.description.scrollbarThumbBitmapUri = "pkg:/images/scroll/scrollbarThumbBitmapUri.9.png"
	m.top.appendChild(m.description)
	m.description.setFocus(true)
end sub

Hope it will be usefull for someone with the same problem as me.

0 Kudos