The wide variety of Pixels Per Inch (PPI) measurements and overall screen resolution differences across Android devices can make it difficult to make sizing and layout decisions when creating visual elements, especially interactive elements, as these must be large enough for users to touch with their fingertips easily. It is generally accepted that a physical measurement of a half inch square is ideal for proper touch. In this recipe, we will demonstrate how to ensure the same physical specifications across devices.
We will create some visual elements on the screen that are sized to physical measurements based upon the detected device display PPI:
1. First, import the following classes into your project:
import flash.display.Shape; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.display.StageOrientation; import flash.events.StageOrientationEvent; import flash.system...