How to scale my app to fit device dimensions?

My apps dimensions are 800x450.
My android devices dimensions are 540x960.
With this of course when I installed on device the app appeared non scaled inside a window on my mobile device.
I have the  XML set to the
Now I'll show you some of my code.
  public static var gameStage:Stage;
public function initApplication():void
   this._game = new MovieClip;
   super.addChild(this._game);
  private function initThreeBalls():void
   gameStage = this._game.stage;
   var starBackGround:Stars = new Stars; // Add a background large 1200 x 3000 texture
Here is some code I found here:
var appScale:Number = 1;
var appSize:Rectangle = guiSize.clone();
var appLeftOffset:Number = 0; // if device is wider than GUI's aspect ratio, height determines scale
if ((deviceSize.width/deviceSize.height) > (guiSize.width/guiSize.height))
appScale = deviceSize.height / guiSize.height; appSize.width = deviceSize.width / appScale;
appLeftOffset = Math.round((appSize.width - guiSize.width) / 2);
} // if device is taller than GUI's aspect ratio, width determines scale
else { appScale = deviceSize.width / guiSize.width;
appSize.height = deviceSize.height / appScale; appLeftOffset = 0;
http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html
Wondering what elements I apply this code to?
It doesnt seem to work with Stage..

Did you write that correctly? Your app is landscape, and you've given portrait figures for the device. Did you mean 960x540?
That aside, you can remove all of your code and let Flash do the scaling for you. In your game scene make it so that there is important content in the middle, and extra content at the edges. There are three variations of working this way:
1.
1.1 Set your stage to 800x600, the aspect ratio of the iPad, and have extra content to the left and right of the stage, going out far enough to make the content be 1066 pixels wide.
1.2 Don't use any code to set the stage scale, the default of "show all" is what you want.
1.3 When you play the game on an iPad it will show the middle 4:3 of the game. On an iPhone it will show a little bit more, and on the widest Android it will show even more. That extra content can be say more of the background, or more of a star field.
2.
2.1 Set your stage to 960x540, which happens to be the widest Android ratio. Have extra content above and below the stage, so that it reaches to a height of 720.
2.2 Don't use any code to set the stage scale, the default of "show all" is what you want.
2.3 When you play the game the Android will see exactly what was in the stage area, and the iPhone will see a little bit of what was above an below the stage. The iPad will see all of what was above and below the stage.
3.
3.1 Set your stage to 840x540, where the middle 720x472 is the important part of the scene, and near the four sides of the stage is content that is within the stage, but not crucial. Much the same as when dealing with action safe on TV.
3.2 Set the stage scale mode to "no border":
     import flash.display.StageScaleMode;
     stage.scaleMode = StageScaleMode.NO_BORDER;
3.3 Now when you play the game you will see all of the height of the stage on iPad, but will miss a little of the left and right, and you'll see all of the width of the stage on the widest Android, but will miss a little of the top and bottom.
The good thing about the above approaches is that it will work for every device size there is, not just the one you mentioned, and all without any code.

Similar Messages

  • How do i transfer apps from one device to another?

    how do i transfer apps from one device to another?

    Correct, but if you have your apps and app settings set to sync with your Google Account, they should have the data with them.

  • How do you launch apps on your device when it keeps saying my device was not known any advice?

    How do you launch apps from your device mine being a Macbook pro?

    Hi TammyPruett,
    I apologize, I'm a bit unclear on the exact issue you are describing. If you are having issues launching applications on your Mac, you may find the following articles helpful:
    Mac OS X: How to troubleshoot a software issue
    http://support.apple.com/kb/ht1199
    Apple Support: Troubleshooting the Mac App Store
    http://support.apple.com/kb/ts3624
    Regards,
    - Brenden

  • How can I install apps on a device that has a "for work" app installed?

    Hi, I have an iPod touch version 4.3.5 (ML1). Model is MC540C.
    It has been provided for me from work, but I can use it as I wish.
    The apps that are installed are:
    Facetime
    Music
    Photos
    Camera
    Videos
    YouTube
    Stocks
    Notes
    Weather
    Utilities
    App Store
    Game Center
    Settings
    Contacts
    iTunes
    Safari
    Maps
    Mail
    Calendar
    "one app installed by company"
    The last app is needed for when I do work. It doesn't need to run on the background. When I'm doing work, I need to input some information in that app, and sync it to my company's server.
    I would like to install some apps (free) of my choosing. But I'm coming across a hurdle...
    I choose "App Store" in Home.
    I search for a free App (for example the Google Search app by Google Inc)
    I'm taken to the app's info screen. I tap the blue "Free" button.
    The button becomes a green "Install App" button.
    I get a pop-up box saying
    Apple ID password
    [email protected]
    [password]
    How can I install apps of my choosing without having a "work app" get deleted? This work app was installed on the "[email protected]" Apple ID.
    Thank you.

    Ingo2711, when you did this:
    I logged out of my AppleID on the iPod, took it to his computer, synced it, which erased all of my apps. I installed the default apps plus one app that he bought using his account info.
    You made his computer the syncing computer.
    When you did this:
    Connected to my Mac and iTunes and tried to sync one of the apps I bought with my account. The app shows up on one of the pages before you start the sync, but once you apply the sync, it does not transfer.
    And, of cause, no restrictions set at all.
    You changed syncing computers but you can only sync apps (and some other things like photos) from only your one syncing computer.

  • How do scale my picture to fit on the wallpaper

    Does anyone know how to scale pictures with new ios?

    Sounds like you have probably zoomed it accidentally. Press command-option-8 to turn it off.

  • How can I access apps on one device from two iTunes accounts?

    I have been told that apps can be loaded on the iPad from multiple iTunes accounts. Is this true?  If so, how does one do it.  My son has a school issued iPad.  The school IT lead informed us that we could use apps that the school provides form the school's account and apps from our personal iTunes account. Please advise. Thank you.

    You have to sign in and out of the accounts in the settings.
    Settings>iTunes and App Store>Tap on the ID and sign out then sign in with the other ID. If you are running iOS 5 or under, it is Settings>Store>Tap the ID and sign out and sign in with the other ID.
    You might want to read this first.
    iTunes Store: Associating a device or computer to your Apple ID

  • How do I restore apps to multiple devices?

    I will be giving iPads to my children for Christmas. How do I restore the saved data for each game/app to a specific device?
    Here's my scenario. My wife and I each have an iPad on the same iTunes account. My children play the same game, but to preserve each other's progression, my son plays this game only on one iPad while my daughter plays it on the other.
    When I setup the new iPads, how do I restore my son's saved data to his iPad and my daughter's data to hers?
    Both children use each iPad so a full restore doesn't help.
    Can I pick-and-choose what saved data from what app goes to which new iPad?

    JimHdk wrote:
    Thanks for clarifying that the situation is more complex than described in your original post.
    No, you cannot pick and choose with standard restore procedures.
    There are some PC/Mac programs that allow recovering certain things from backup files. Whether these can restore arbitrary app data I do not know. I suspect not but you can investigate further.
    For example:
    http://www.iphone-ipad-recovery.com/recover-data-from-dead-broken-ipad.html
    http://www.iphone-data-recovery.com/restore-ipad-from-backup.html
    Hello, I can't scan out my lost data from iPad directly, doesn't it means that I only can recover my lost data from backup?

  • How do I transfer apps to another  device I have new ipad for my wife and need to put her education apps onto her new ipad

    I have just purchased a new ipad for my wife. On my ipad we purchased education apps for her to use , I have placed the apps on her ipad but when we open her itunes account to sync apps  the computer will remove these apps and only leave her existing apps. How do I get around this problem. I have already paid for these apps and have not exceeded my number of devices. Glenn

    Try a re-download using her iPad...
    http://support.apple.com/kb/HT2519
    Be sure to use the Apple ID that made the Original Purchase(s)...
    Also, See Here...
    http://macmost.com/sharing-ios-apps-with-family.html

  • How do i separate apps on multiple devices

    I have an IPhone with an Apple ID and user name.  My 10 year old son has an IPod Touch and now a new IPad.  Somehow when we set up his touch and pad, he got connected to my account.  I say this because all of my apps, songs, contacts etc show up on his devices.  I want his devices to be separate from mine so that when he downloads games they don't show up on my phone.  Is this happening because his devices are connected to the same icloud or via Itunes? 

    It might be both.
    If his apps, music and other purchased media are automatically downloading to your phone, it may be because you are using the same Apple ID in Settings>iTuens & App Store and you have Apps, Music, etc. turned on under Automatic Downloads.  To stop this, turn off these items under Automatic Downloads.
    If you are getting each other's contacts and other iCloud data on your devices it's because you are sharing the same iCloud account in Settings>iCloud.  To fix this, one of you needs to migrate to a separate iCloud account with a separate ID (you can do this and continue to share the same ID for iTunes).
    To migrate to a new account, start by saving any photo stream photos you wish to keep to your camera roll (unless already there) by opening your my photo stream album, tapping Select, tap the photos, tap the share icon (box with upward pointing arrow), then tap Save to Camera Roll.  If you are syncing notes with iCloud, you'll need to open each of your notes and email them to yourself so you can later copy and paste the text into new notes created in your new account.  Then go to Settings>iCloud, tap Delete Account (which only deletes it from this device, not from iCloud; the device keeping the account will not be effected by this), choose Keep on My iDevice and provide the password to turn off Find My iPhone.  Then sign back in with a different Apple ID to create your new account and choose Merge to upload your data.  The new account will be assigned a new @icloud email address when you turn on Mail.
    Once you are on separate accounts you can each go to icloud.com and delete the other person's data from your account.
    If you are sharing the same ID for iMessage and FaceTime you will also end up getting each other's text messages and FaceTime calls.  If you are, the person that migrated to the new iCloud account should go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign back in with their new iCloud ID.  Then do the same thing in Settings>FaceTime.

  • How do i get apps on multiple devices with the same AppleID

    I havev 34 iPads in my classroom. I need to add apps as I find them. Is there a way to put the apps on all of the iPads using one action instead of having to install the app on each iPad? It takes way too long to put individual apps on individual iPads after they have been inititally setup.

    Buy a copy of OS X Server and use Profile Manager to set up the devices.  You can use it to specify which apps they have on them.  After you've made a change, the next time device connects to the internet it will automatically catch up with the new settings.
    http://support.apple.com/kb/HT5366
    http://www.apple.com/uk/osx/server/features/#profile-manager

  • When you have 2 apple IDs with apps: How to access all apps on a device?

    Hi.
    I couldn't use my newly bougt IPhone because for some reason I wasn't allowed to use my old Apple ID. I got help from an Apple Chat-service (which I can't remember how I found...) with creating a new Apple ID, but where's my previous purcases? I had a ton of apps on the old ID, how do I transfer them to the new one? I've bought some apps with the new one, but it seems like I must delete all my previously bought apps to access the new ones if I want to sync with my laptop (can't sync with two libraries on PC)... It would have been so much easier if I could just merge the IDs completely...

    I found out that I can download things from App Store on the iPad from a different ID that is used to sync with PC. But it would have been nice to just have one ID for all, plain and simple. Merging of acoounts should be possible, this would make shopping much less complicated for users who have to use several IDs.

  • How to send a app to another device using icloud

    I want to send my imovies to my another device using icloud.....i downloaded imovies with my bros account and now i have different app store account. So can i still send my app to my another device with my new apple account.

    You cannot "send" an app via iCloud, the purchase is saved but only accesible to the same AppleID...app purchases are tied to a specific AppleID.  If you want one purchased under your brother's ID you must purchase under your ID.

  • How do I delete apps from my device?

    I have tried to go into itunes on my computer to delete my apps but it doesnt show up on my device. My Ipod also does not show the red X at the top of the app if i hold down on it till it shakes. what do I do? I really need to delete some of my apps!

    DELETING APPS
    Touch the app and hold your finger down until all the apps start to jiggle. You will see a circled "x" in the upper left corner. Tap it to delete an app. When done press the Home button.
    You cannot delete any pre-installed iOS app.
    If there is No 'X' on any apps you have Downloaded... then check in Restrictions... Settings > General > Restrictions > Deleting Apps  =  Off / On
    If the app is in iTunes, then you delete the app in iTunes (Select the App and Press Delete on your Keyboard). If you then sync with your iDevice, the app will also be deleted from your iDevice.

  • How to use your apps on another device

    Hello
    I have an icloud account and an old i touch that is formatted for a PC, can I sign in with my icloud account and load my apps onto the i touch?
    Thanks in advance

    Not sure what you mean by formatted for a PC.
    You don't need to sign into iCloud to redownload your previouysly purchased apps. Just visit the store, tap updates > puchased > not on this iPod and download any app you choose.

  • How to scale my stage to fit smaller screens?

    I'd like to resize the whole stage (while keeping my width/height ratio) to fit smaller screens until it reaches its minimum dimensions (let's say 75% of the original size). I thought of using the css property "zoom" but nothing have worked yet. My default stage dimensions are set to 1024px by 728px.
    Thank you very much!

    It works great but it seems like we can't set a maximum width/height... I would like my stage to "grow" until it reaches its maximum size (1024 x 768) even if the screen is larger than those dimensions.

Maybe you are looking for

  • I can't see my Library any more!

    I wanted to create a new calander for 2014, so I created a new catalog and started to import 25 images which were in my library in various folders. once I was done with the selections I could see that there are several catalogs set up from each folde

  • NOKIA Series 60 Error HTTP Connection

    Hi.. Im developing a MIDlet that uses a HTTPconnection The MIDlet worked fine using the Default emulator (Grayphone and the ColorPhone). But when i tried it on NOKIA emulator (Series_60 MIDP_SDK for Symbian OS v 1_0) it couldnt create a connection. I

  • How do I get a new Home Hub?

    I have an old white Home Hub, and I never received the Hub Phone part. A shiny Black HH seems a better product. My 18 month BB Option 3 and BT Mobile contract expired in November, and I stayed on the £5 per month deal for my HTC S620, paying £29.99 p

  • Export procedure not fill in automatic

    Hi Gurus, I have some problems with the export procedure in SAP. I have done the customizing on the "Define procedures and Default Value" in the Basic data for foreign trade menu, but when I create a new invoice, this information is not fill in autom

  • Training & Event Managemet - Correspondence

    I see that SAP's Training and Event Management provide auto generation of emails for triggers such as Waitlisted, Cinfirmed, etc. Appreciate if someone can help me with configuration steps to make sure the Correspondence functionality works OK in Tra