Your Digital Media Has Never Looked So Good

 
greubel
Topic Author
Posts: 708
Joined: Wed Feb 10, 2010 4:21 pm

Flashing on a progress screen

Mon Mar 01, 2010 10:08 am

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 )
-------------------------------
 
User avatar
RokuKevin
Roku Engineering
Posts: 796
Joined: Tue Sep 22, 2009 2:29 pm

Re: Flashing on a progress screen

Tue Mar 02, 2010 6:07 pm

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

Who is online

Users browsing this forum: No registered users and 1 guest