issue since 4.8 update

Ive had an issue with my splash screen code not functioning since the 4.8 update. It works on Roku 1s but not 2s. On Roku 2s the screen flashes and then closes out of the application. This used to work fine. Thanks in advance.


Sub RunUserInterface()
    deviceInfo = CreateObject( "roDeviceInfo" )
    displaySize = deviceInfo.GetDisplaySize()
    if displaySize.w = 1280 then
    background = {
        Color: "#FFFFFF"
    }
    loadingImage = {
        Url: "pkg:/images/indie_hd.png"
         TargetRect: {
                       w: 1280, h: 720
        }
    }
        canvas = CreateObject( "roImageCanvas" )
    canvas.SetLayer( 0, [ background, loadingImage ] )
    canvas.Show()
 
    Sleep(6500)
    else if displaySize.w = 720 then
    background = {
        Color: "#FFFFFF"
    }
    loadingImage = {
        Url: "pkg:/images/indie_sd.png"
         TargetRect: {
                       w: 720, h: 480
        }
    }
        canvas = CreateObject( "roImageCanvas" )
    canvas.SetLayer( 0, [ background, loadingImage ] )
    canvas.Show()
 
    Sleep(6500)
	end if

    '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.
    screenFacade = CreateObject("roPosterScreen")
    screenFacade.show()

    Main()
    
    screenFacade.showMessage("")

    End Sub

Are there any error messages logged to the debug console?

It looks like you’re calling a Main() function from inside the RunUserInterface() function. I think those two function names are mutually exclusive as entry points. It’s possible that 4.8 has become more strict about that…?

Otherwise, it might be a scoping issue. I haven’t tested it specifically, but it’s possible that 4.8 limited scope in Brightscript like more traditional languages. Since you’re declaring and setting the canvas object inside the if…then block, it may be going out of scope when you leave that block, before it’s able to create the facade to keep the channel alive. Try declaring the canvas variable outside of the if…then block:

canvas = invalid
if displaySize.w = 1280 then
    canvas = CreateObject("roImageCanvas")
.
.
.
end if

Alternatively, you could use manifest based splash screen… http://blog.roku.com/developer/2012/02/ … h-screens/

thanks. i will work on it tonight.