AS3 Inches to Pixels


/ Published in: ActionScript 3
Save to your folder(s)

This function is from Christian Cantrell's Adobe article called 'Authoring mobile Flash content for multiple screen sizes'.


Copy this code and paste it in your HTML
  1. function inchesToPixels(inches:Number):uint
  2. {
  3. return Math.round(Capabilities.screenDPI * inches);
  4. }
  5.  
  6.  
  7. var myWidthInInches:Number = 1.5;
  8. var myWidthInPixels:uint = inchesToPixels(myWidthInInches);
  9. trace("myWidthInPixels: "+myWidthInPixels);
  10.  
  11. // OUTPUT
  12. // myWidthInPixels: 108

URL: http://www.adobe.com/devnet/flash/articles/authoring_for_multiple_screen_sizes.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.