Adobe has made it very easy to add a splash screen to your
application. A splash screen is an image that loads first and displays
while the application is loading. There are also several options for the
splash-screen display. Let’s take a look at the following code, which
shows the splashScreenImage property set to a .png
image. Figure 1 shows a
splash screen with the default settings.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
splashScreenImage="@Embed('happytoad.png')">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:Application>
You can also set some options for the splash screen. Setting the
splashScreenMinimumDisplayTime and
splashScreenScaleMode properties on the
Application,
ViewNavigatorApplication, or
TabbedViewNavigatorApplication tag sets these options.
The next example sets the display time to three seconds and the scale mode
to “stretch.”
The available options for the
splashScreenScaleMode property are letterbox, none,
stretch, and zoom. Figure 2
and the following code show a splash screen with the
splashScreenScaleMode set to stretch.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
splashScreenImage="@Embed('happytoad.png')"
splashScreenMinimumDisplayTime="3000"
splashScreenScaleMode="stretch">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:Application>