Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
greubel
Visitor

Flashing on a progress screen

I'm sure people have had the problem of flashing screens, I just wanted to post a possible work around.
This keeps the current screen active till AFTER the new one gets displayed.
--- Start the screen -----
port = CreateObject("roMessagePort")
dp = CreateObject( "roArray", 2, 1 )
dp.Push( CreateObject( "roMessageDialog" ))
dp[0].SetTitle( "Please Wait - Loading" )
dp[0].SetText( "What ever" )
dp[0].AddButton(0, "Cancel")
dp[0].SetMessagePort(port)
dp[0].Show()
--- Update the screen -----
dp.Push( CreateObject( "roMessageDialog" ))
dp[1].SetTitle( "Please Wait - Still Loading" )
dp[1].SetText( str )
dp[1].SetMessagePort(port)
dp[1].AddButton(0, "Cancel")
dp[1].Show()
dp.Delete( 0 )
-------------------------------
0 Kudos
1 REPLY 1
RokuKevin
Visitor

Re: Flashing on a progress screen

It's important that you always have a blank background screen to show under all your screens so that you don't "flash" back to the home screen momentarily. Channels that forget this may run into home screen flashes when they add a linking screen or search screen that becomes the base of their screen stack. It's also useful as a precursor to slow loading screens, and can be used anywhere in your code that you need a default background. This blank background screen is well documented as the "screenFacade" pattern in the developer guide and sample applications, but here's a refresher:

'display a fake screen while the real one initializes. this screen
'has to live for the duration of the whole app to prevent flashing
'back to the roku home screen. By default roPosterScreen displays
'the message 'retrieving...'
'----- Screen Facade Background here ---------------
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()

'---- Slow loading Screen Here ----
' your normal code

'exit the app gently so that the screen doesn't flash to black
screenFacade.showMessage("")
sleep(25)

--Kevin
0 Kudos