Quantcast
Channel: Adobe Community : Popular Discussions - Using Flash Builder
Viewing all articles
Browse latest Browse all 70427

How can I set an images height/width to display in inches for an iOS app?

$
0
0

I am currently attempting to return the name of the device, then manually assigning a DPI.  I am then multiplying that DPI times the number of inches that the image will display at.  Here are the two functions used to determine the device and set the DPI:

 

function getDevice():String {

          var devFinal:String;

          var devStr:String = Capabilities.os;

          var devStrArr:Array = devStr.split(" ");

          devStr = devStrArr.pop();

          devStr = (devStr.indexOf(",") > -1)?devStr.split(",").shift():debuggerDevice;

 

          if ((devStr == "iPad1") || (devStr == "iPad2")){

                                        devFinal = "ipad";

                              } else if ((devStr == "iPad3") || (devStr == "iPad4")){

                                        devFinal = "ipad3";

                              } else {

                                        //This will be the iPad Mini

                                        devFinal = "ipadmini";

                              }

                              return devFinal;

}

 

function getDPI():int {

          var retDPI:int;

          if (currentDevice == "ipad"){

                    retDPI = 132;

          }

          else if (currentDevice == "ipad3"){

                    retDPI = 264;

          }

          else if (currentDevice == "ipadmini"){

                    retDPI = 163;

          }

          else {

                    retDPI = 132;

          }

          return retDPI;

}


Viewing all articles
Browse latest Browse all 70427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>