Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
In this course, author Paul Trani demonstrates how to create, test, and publish a mobile app that works across multiple platforms (iOS, Android, and BlackBerry Tablet OS) and adapts to either a smartphone or tablet display. The course also tackles the issue of various screen sizes and density and how to scale and adjust content.
Understanding the capabilities and constraints of devices will really go a long way in making your app the best it can be. So what we are going to do is I am going to go ahead and show you how to check out all of the capabilities of the actual device the contents running on, and then you can start to make decisions based on that information. So what I am going to do first off is go to help, launch the Flash Help. In the Flash Help go ahead and do a search on Capabilities and then select flash.system.Capabilities from the ActionScript 3.0 Reference.
So here it gives me this class, the Capabilities class, I can scroll down and see all of the various properties and click into each one of these, but really what you want to use the help for most of all are the code snippets that you get in here. So there are examples as I scroll clear down to the bottom, there's one right in here and it's the CapabilitiesExample.as files right here. It will go ahead and use the Capabilities object and put that information in the text field as well as put it in a trace statement.
So this is nice, I can go ahead and take this code, select it all, right-click, copy it and now I can jump into Flash. Let me minimize to help, back in Flash, I am going to go ahead and create a new file. In this case it's going to be an ActionScript 3.0 Class, remember it's called CapabilitiesExample, just like that, click OK and when I do that notice that it actually puts that name right in there.
So you do need to name the file appropriately and paste the code in there appropriately. So when I paste it in there, it gives me all my code and it still says CapabilitiesExample. So let me save this file and I'm going to go ahead and save it into this com folder, in this folder called utils, short for utilities, because this is something that I can actually use over-and-over again. It's not really specific to this project. Okay, this is an ActionScript file, click Save, and there it is.
Now keep in mind since I put it in that folder and I want to use it in the Monster.fla I need to change the package. So right up here, for the package, since it is in the com folder and end up type-in com.utils, and that's all I need to do. So I need to make sure the folder structure is set up right in here separated by Periods. So that looks good. I will save it.
So that package is created, it has this class right in here, and now I want to go ahead and use that in my Monster. fla, in fact, if I edit that class definition, I can take a look at this import statement. It's already pointing to this other class that I have created, that really I need to type-in import com, there it is. I can select that, Period. Now there are those three folders. I can select utils, just like that, and lastly CapabilitiesExample.
So now I am importing that entire package, but I want to use that CapabilitiesExample class. So I will just scroll down and right where I create all these various variables and instantiate some different items I can go ahead and instantiate that CapabilitiesExample. So I am going to go ahead and type-in private var, cap for capabilities, type-in CapabilitiesExample that shows up in my code hinting I can select it, equals new CapabilitiesExample.
All right, so we will go ahead and create a new CapabilitiesExample object based on that class. So I am going to save it and I am going to go back to my example ActionScript file because if I take a look, it actually is going to create this text field, and if I hit F4, we can take a look at this code a little easier. It's going to create this text field and put all of this information in a text field. And that's fine but I don't really want to have that displayed in my apps so I am going to select all of that code, in fact cleared out here to this addChild and I'm just going to delete it, because I don't want that code to appear in my app.
What I do want to see are all these trace statements, so in here I can start to get all of the information whether it's the pixelAspectRatio, screenColor, the DPI, the Resolution whatever I want to get I can go ahead and get that from these trace statements. Also keep in mind this is an AIR for mobile app, I can go ahead and uncomment these lines as well to get the cpuArchitecture, the languages things like that. So these are all the trace statements that I want to go ahead and see in my app.
Now the key thing here is I want to go ahead and debug this on my device. So I am going to save this file and I am going to go to debug and I am going to debug this on my device by USBs. When I do this, it's going to go ahead and give me all of those trace statements. Here we can see it running on my connected Android device, this is my app and really what I have done is I've implemented all these trace statements. That's going to go ahead and ping this device and figure out all the capabilities that this device can do.
So that's what it looks like on my device, let's go ahead and check it out in Flash Professional. Here it is, in Flash Professional you can see it changed my workspace to the Debug mode, in fact, if I just expand this out a little more and scroll up, you can see all of those trace statements that it's getting from my device. So as I scroll down I can see all of its capabilities, the manufacturer, so I can tell it's on an Android or an iOS device gives me the pixelAspectRatio. This is interesting; I start to get the Resolution of the device for 480x800, I can get the DPI, so the dots per inch or pixels per inch, as I scroll down I can even get the language.
So this is great, based on this information I can actually start to swap out some of the content if I want. So I can adjust the interface like I'm doing but I can more intelligently ping the device and say for instance if it's a device that is showing Spanish, I can change my language and all of the text in my app to Spanish. So you can see how powerful this is being able to get those system capabilities and then start to adjust your content based on the capabilities of the device.
There are currently no FAQs about Building Mobile Apps for Multiple Devices with Flash Professional.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.