B4J Code Snippet Splash Screen

Discussion in 'B4J Code Snippets' started by Erel, Aug 7, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Simple sub to create a splash screen.

    splash.gif
    Code:
    Sub ShowSplashScreen
       
    Dim sp As Form
       sp.Initialize(
    "sp"600600)
       sp.SetFormStyle(
    "TRANSPARENT")
       sp.BackColor = fx.Colors.Transparent
       
    'change image here
       CSSUtils.SetBackgroundImage(sp.RootPane, File.DirAssets, "B4R_512_512_transparent.png")
       sp.Show
       sp.RootPane.Alpha = 
    0
       sp.RootPane.SetAlphaAnimated(
    5001)
       
    Wait For (sp.RootPane) sp_AnimationCompleted
       Sleep(
    3000)
       sp.RootPane.SetAlphaAnimated(
    10000)
       
    Wait For (sp.RootPane) sp_AnimationCompleted
       sp.Close
       CallSubDelayed(Me, 
    "Splash_Complete")
    End Sub
    Project is attached.

    Edit: sp.Close was missing.
     

    Attached Files:

    Last edited: Aug 7, 2017
Loading...