Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Implemented
-
Apache Flex 4.11.0
-
None
Description
Some components should have different layout on phone and tablet devices.
For example, DropDownList should display as a centered popup list on phones, and display the drop down list below its popup button on tablets, supposedly having move screen space
Implementation notes:
the following @media selectors have been implemented:
device-width : standard, current device width, depending on the orientation
device-height : standard, current device height, depending on the orientation
-flex-device-diagonal : non-standard, current device diagonal
All three selectors can be expressed with units.
The following units are valid: (no unit), px, pt, in, cm, dp
no unit => physical pixels
px => physical pixel
pt => pixels-equivalent at 72 ppi
dp => pixels-equivalent at 160 ppi.
Note that pt, in and cm are based on "raw" device dpi, whereas dp is based in normalized "applicationDPI".
For optimization reasons, -flex-device-diagonal is guaranteed to never change so that styles do not needed to be recomputed. This is mainly useful on mobile devices.
Examples of valid media queries:
/* phones */
@media (-flex-max-device-diagonal: 5in) {
global
}
/* tablets */
@media (-flex-min-device-diagonal: 5in) AND (-flex-max-device-diagonal: 11in)
{
global
}
Note: deviceWidth, deviceHeigth and flexDeviceDiagonal are accessible in actionScript with eg.
MediaQueryParser.instance.flexDeviceDiagonal
This returns an object of type: mx.styles.CSSDimension (see Apache documentation for reference)