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

Adapting content for specific devices

From: Building Mobile Apps for Multiple Devices with Flash Professional

Video: Adapting content for specific devices

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.

Adapting content for specific devices

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.

Show transcript

This video is part of

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 Building Mobile Apps for Multiple Devices with Flash Professional.

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


OK

Course retiring soon

Building Mobile Apps for Multiple Devices with Flash Professional will be retired from the lynda.com library on October 15, 2014. Training videos and exercise files will no longer be available, but the course will still appear in your course history and certificates of completion.


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.