Start learning with our library of video tutorials taught by experts. Get started

Flex 4.6 and AIR 3.0 New Features for Mobile Apps

Using the SplashScreen component


From:

Flex 4.6 and AIR 3.0 New Features for Mobile Apps

with James Talbot

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.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Flex 4.6 and AIR 3.0 New Features for Mobile Apps
1h 49m Intermediate Jan 30, 2012

Viewers: in countries Watching now:

Join James Talbot, as he reviews the new features in Adobe Flex, Flash Builder, and AIR for mobile application developers. This course covers the Spark components for building mobile user interfaces in the Flex SDK, and the AIR support for native extensions, which enable applications to use parts of the host operating systems that were previously unavailable. The course also describes new testing and network monitoring capabilities available with Flash Builder 4.6, and the ability for Android applications to be deployed without relying on a separate runtime.

Topics include:
  • Controlling adaptable tablet layouts
  • Controlling view hierarchy
  • Using 16-bit and 32-bit render modes
  • Using the Date Picker, Scroller, and List components
  • Adding a splash screen to a mobile app
  • Using native extensions for iOS and Android
  • Testing with FlexUnit on Wi-Fi
  • Packaging the application for release
Subjects:
Developer Mobile Apps
Software:
AIR Flash Builder Flex
Author:
James Talbot

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.

There are currently no FAQs about Flex 4.6 and AIR 3.0 New Features for Mobile Apps.

Share a link to this course
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.
Upgrade now


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.

Upgrade now

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
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



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.

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