Friday, March 9, 2012

Flex Mobile Development – Dynamic Splash Screens

Flash Builder 4.6 includes a new feature to allow you to add a dynamic splash screen component to your mobile application. This feature will allow you to load a different image based on a few different properties you can set to ensure you get the best image for the right device. The properties you can use to determine which image is displayed for the splash screen are:

dpi
minResolution
aspectRatio


You can combine these attributes as well to get the best possible image selected. It’s very easy to implement, you simple create an MXML component based on the SplashScreenImage property and include as many SplashScreenImageSource objects to cover the number of situations needed. For example, in the following code I’m setting different images depending on both dpi and aspectRatio properties. Note that this example makes an assumption about tablets generally being 160 DPI (thus needing the bigger image), the 320 DPI being the iPhone 4 and above and most android phones at 240 and setting the image based on that. It also assumes that I want to use the landscape version of the image when the aspectRatio happens to be landscape on startup. You could also use the minResolution to further ensure that the 160 DPI is indeed a tablet etc and that will cause the the stage width and stage height to be compared on startup to find the largest number of the two. If it’s equal to or greater than your minResolution setting, it will select that image for the splash screen.

Read More..

For Free consultation on regarding Flex Development, Flex Programmers, and Flex Developers,  log on to http://www.dckap.com/

No comments:

Post a Comment