AS3 Millimeters to Pixels


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

This is taken 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 mmToPixels(mm:Number):uint
  2. {
  3. return Math.round(Capabilities.screenDPI * (mm / 25.4));
  4. }
  5.  
  6.  
  7. var myWidthInMillimeters:Number = 38;
  8. var myWidthInPixels:uint = mmToPixels(myWidthInMillimeters);
  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.