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
  2. gvoulg

    gvoulg Member Licensed User

    getting this error when running the program
    Waiting for debugger to connect...
    Program started.
    Αυγ 23, 2017 1:39:33 ΜΜ com.sun.javafx.css.parser.CSSParser term
    WARNING: CSS Error parsing '*{-fx-background-image:url(file:/C:/Program%20Files%20(x86)/Anywhere%20Software/B4J/Projects/B4J/Files/B4R_512_512_transparent.png);-fx-background-size:stretch;}: Unexpected token 'file:/C:/Program%20Files%20' at [1,23]
    Regards
    George
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    gvoulg likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice