Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using the SplashScreen component

From: Flex 4.6 and AIR 3.0 New Features for Mobile Apps

Video: Using the SplashScreen component

With the ever-growing number of devices and different form factors, the implementation of Splash screen in Flex 4.5 was simply not going to scale. Adobe has created a brand-new component with the name of SplashScreenImage for Flex 4.6. SplashScreenImage was specifically designed to let us specify different Splash screens based on the specific device and orientation. To create this new dynamic Splash screen, all we have to do is create a new MXML file based on Splash screen image and then add multiple instances of Splash screen image source that define what asset to use, based on the DPI, or dots per inch, or screen resolution of the device.

Using the SplashScreen component

With the ever-growing number of devices and different form factors, the implementation of Splash screen in Flex 4.5 was simply not going to scale. Adobe has created a brand-new component with the name of SplashScreenImage for Flex 4.6. SplashScreenImage was specifically designed to let us specify different Splash screens based on the specific device and orientation. To create this new dynamic Splash screen, all we have to do is create a new MXML file based on Splash screen image and then add multiple instances of Splash screen image source that define what asset to use, based on the DPI, or dots per inch, or screen resolution of the device.

Let's explore how to do this. So the first thing I'm going to do is open up Flash Builder of course, and I'm going to import a new project, and I'm going to import here, under Starting, 1-9.fxp. And then I'm going to click Finish and here's my 1.9.fxp, and you'll see here that I have some assets here. I have some different California flags, all PNG files, but one designed for 160 dots per inch, one designed for 240 devices, and another designed for 320. And then I have another California flag designed specifically for tablet devices.

I have a components folder that's already here, and then I have a default package with my SplashScreen.mxml. And you can see again just a very simple application tag, nothing in here, and it's being targeted here for a device with an application dpi of 160. Okay, so inside of my components package, I'm just going to build a brand-new component. Ao I'm going to say New > MXML Component inside of the components, and I'm going to call this MySplashScreen, okay. And then what I'm going to do is I'm going to utilize the SplashScreenImage control, so I'm just going to search for the SplashScreenImage.

Okay, and I'm going to inherit from this SplashScreenImage that you see here. So I'm going to click Finish, and this is going to build me a new component. Notice it says SplashScreenImage up here, so of course, it's inheriting from that. And then what I'm going to do is below the Declarations tag, I'm just going to add in a SplashScreenImageSource. So here, I'm going to simply say s:SplashScreenImageSource and I'm going to say okay.

If the dpi of the device is 160, I'm going to simply specify the source and I'm going to utilize this image. So here, I'm going to say source and we will embed this into our application, so I'll say @Embed, and I'll simply just say quote, dot, dot, and I'll say assets, which of course is my assets folder right here, and I'll say assets califlag160.png and I will close off the quote there, and then close that off as well.

So what I'm going to do is just, to save myself some typing, I'll simply just take this code, copy it, and paste that in right here, and then I'll say OK. So for a dpi of 240, let's pull in my 240 image. Perfect. And then here, I'll say for dpi of 320, and then the califlag here will of course specify 320. And then I will just paste one more time here, okay, and then instead of saying dpi here, we're going to say minResolution. And I'll say minResolution of 960, and then I'm going to simply specify my source and in this case instead of saying califlag, we're going to go to my calitablet PNG.

So again, I'll say calitablet.png, and this will be appropriate for tablet devices here. So I have my minResolution 960, the source Embed, and I have that there. Make sure your SplashScreenImage is saved, and then after this has been created, let's go back to my SplashScreenImage here, and what I want you to do is simply assign the class image to the SplashScreenImage in your main application tag. So here we're going to simply just say SplashScreenImage and I'm going to simply assign that class instance in my main application tag.

So here I'm going to simply say SplashScreenImage is equal to components.MySplashScreen, like so. All right, hit Save, and let's go ahead and test this on some different devices. So now if I say Run Configurations, and I go to my Mobile Application, we'll try--let's see what happens if I test this on an iPad. So I'm going to click here, and you should see the tablet image pops up as our Splash screen, and we saw a tablet image there.

Well, let's try it now on an Apple iPhone 3GS, the first-generation iPhone here. So I'm going to click there, and that's 160 dpi, so you can see that pulls in. Okay and let's now try it on an Apple iPhone 4 and see what happens there. And that's a 320 dpi. So you can see, depending on the device, it's going to pull in the appropriate image directly, so again, a huge enhancement here to the Splash screen image and very, very powerful.

Show transcript

This video is part of

Image for Flex 4.6 and AIR 3.0 New Features for Mobile Apps
Flex 4.6 and AIR 3.0 New Features for Mobile Apps

21 video lessons · 4237 viewers

James Talbot
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Flex 4.6 and AIR 3.0 New Features for Mobile Apps.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.