Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
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.
Now if you can get the device's capabilities, you can have your content adapt based on that information. For instance, you can serve up graphics that are less processor intensive based on the processing speed of the device. Or you can change the content based on the language of the device as well, which is what I want to do. But I did want to point you to the help, because in the reference for capabilities, you can see that long list of various properties that you can get of the device.
And in my case, I want to get the language, so I will click that Language property. Notice how each one has a Value and I want to go ahead and ping the device, and if it has the Value of Spanish go ahead and swap out just a couple of the words, okay. So that's what I want to do. I am going to use the Language and if it's equal to es, swap out that language, otherwise default to English. Now in my file, these are the three words that I want to change. So I will jump in here and I will just select inside of this easy button, that word Easy.
Delete it, because I want to add a text field that set to Dynamic Text. So its Classic Text set to Dynamic, because it's dynamically going to change. The font Family is just the default sans serif font of the device so that might be Droid Sans on the most Droid devices. The Size is 26 points and the Color is white, in fact, I can drop that down a little bit, but you don't want to go below say about 18 point, because it just gets too small to read.
All right, so set that at about 25, I will draw a text field and I will just type in Easy just like that. I'll reposition it right there in the center, still kind of tough to read, so what I will do is I will add a Filter, in fact, we will just give it a Drop Shadow, just to make it pop off there a little better. That looks pretty good. And now I need to give it an Instance Name of easy_txt. So that's it Instance Name, I will be targeting later.
I will take this text field, I will copy it, because I need to put it in here as well in the Medium button, paste in that text and Medium, just like that, perfect! Jump back out oh hold on one second let me just jump back in there, sorry, because I need to make sure the Instance Name says Medium. In this case, actually I am actually I am going to type in med_txt. All right, so that looks good. Next up, this text right here for my Hard button, I'll paste in that text field and write in here Hard, just like that and let's give it an Instance Name of hard_txt.
All right, so my three text fields are in place. They are dynamic, which means I can control them with ActionScript, which is great. So I can go to my Document Class which is right here, and then I can go ahead and dynamically change that content. Let me hit F4, I will scroll down and I would say, right in here where this Constructor function is, before the Event Listeners for those buttons, I want to go ahead and type in a switch statement.
So right in here, I am going to type in switch. That's going to get the Capabilities, specifically the language, just like that. Open curly brace, just like that, switch(Capabilities.language), and if that language is equal to es for Spanish, then go ahead and do this, add my break, and then my default will be just like this. Don't forget your colon at the end right here. So case that Spanish, type in what you need to.
Otherwise it will default to English. All right keep in mind that they are inside of this Hard button, Medium button, and Easy button, so I can literally just copy those two words, paste them right in here. So for the introScreen inside of there is the easy button and that's dynamic text field I made, which is easy_txt, make its text property equal to the Spanish word for easy. So I will type in for Facil.
So if I do an F and on Mac I will do an Option+E, will give me that accent, then I type in the letter, Facil, just like that. And now I can move on. So for the next one, inside of that Medium button, so I will copy that word, paste it in here, there is that med_txt for that text property. Make it equal to "Medio" just like that. All right, lastly we have the hard btn where we have the hard text field with its text property equal to Dificil.
So there's actually an accent over this ? as well, so I did the same thing here, just like that. All right, so I have my Spanish language version right here. It's going to swap out this different items and my default is basically going to be the same thing. So I can just copy that and paste that right down here and I can change this to Easy, Medium, Hard just like that.
What's great about this is I can easily expand this for other languages if I want to. But keep in mind I'm just doing those three buttons, obviously there's other text in this game that I probably want to swap out, but you can definitely see the method as to which I would do that. I could even set a variable up if I wanted to, but nonetheless, Capabilities.language will get you whatever languages are set up for that device. All right, so everything looks good. I can go ahead and test this out now.
So I'll save this file, and so let me jump over to the Monster fla and I will save this file. I want to make sure everything is saved and then I'll test it out. To make this work for device that has the language set to Spanish, I first need to set the devices language to Spanish. So under Settings, I can go in here and there's a Language & keyboard. So I will select that. Then I will Select the language right in here, you see that long list of languages you can select, and I will just go ahead and select Espanol.
Okay, so I have the language you can see I changes all of my options in here as well. I will just hit the Home key and now I can go ahead and Publish out to this device. Here's my device, as you can see as it launches, I have those three buttons and you can tell they say Facil, Medio and Dificil.
I might not be saying that perfectly, but you can easily see that it does change the text based on the language 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.