Posted By

adrianparr on 01/05/11


Tagged

dpi pixel size resolution as3 pixels PPI density inches multiscreen


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

swapnil


AS3 Inches to Pixels


 / Published in: ActionScript 3
 

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

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

  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

Report this snippet  

You need to login to post a comment.