Package | mx.core |
Class | public class RuntimeDPIProvider |
Inheritance | RuntimeDPIProvider Object |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4.5 |
Runtime Versions: | Flash Player 10, AIR 2.5 |
Overriding Flex's default mappings is usually only necessary for devices that incorrectly report their screenDPI and for devices that may scale better in a different DPI class.
Flex's default mappings are:
160 DPI | <200 DPI |
240 DPI | >=200 DPI and <280 DPI |
320 DPI | >=280 DPI |
Subclasses of RuntimeDPIProvider should only depend on runtime APIs
and should not depend on any classes specific to the Flex framework except
mx.core.DPIClassification
.
More examples
Related API Elements
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
runtimeDPI : Number [read-only]
Returns the runtime DPI of the current device by mapping its
flash.system.Capabilities.screenDPI to one of several DPI
values in mx.core.DPIClassification. | RuntimeDPIProvider |
Method | Defined By | ||
---|---|---|---|
Constructor. | RuntimeDPIProvider | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
runtimeDPI | property |
runtimeDPI:Number
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flex 4.5 |
Runtime Versions: | Flash Player 10, AIR 2.5 |
Returns the runtime DPI of the current device by mapping its
flash.system.Capabilities.screenDPI
to one of several DPI
values in mx.core.DPIClassification
.
A number of devices can have slightly different DPI values and Flex maps these
into the several DPI classes.
Flex uses this method to calculate the current DPI value when an Application
authored for a specific DPI is adapted to the current one through scaling.
Implementation
public function get runtimeDPI():Number
Related API Elements
RuntimeDPIProvider | () | Constructor |
public function RuntimeDPIProvider()
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4.5 |
Runtime Versions: | Flash Player 10, AIR 2.5 |
Constructor.
<?xml version="1.0" encoding="utf-8"?> <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.RuntimeDPIProviderAppView" applicationDPI="160" runtimeDPIProvider="RuntimeDPIProviderExample" > <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> </s:ViewNavigatorApplication>
package { import flash.system.Capabilities; import mx.core.DPIClassification; import mx.core.RuntimeDPIProvider; public class RuntimeDPIProviderExample extends RuntimeDPIProvider { public function RuntimeDPIProviderExample() { } override public function get runtimeDPI():Number { // A tablet reporting an incorrect DPI of 240. if (Capabilities.screenDPI == 240 && Capabilities.screenResolutionX == 600 && Capabilities.screenResolutionY == 1024) { return DPIClassification.DPI_160; } return super.runtimeDPI; } } }
Mon Nov 28 2011, 06:48 AM -08:00