套件 | mx.core |
類別 | public class RuntimeDPIProvider |
繼承 | RuntimeDPIProvider Object |
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | 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
.
更多範例
相關 API 元素
屬性 | 定義自 | ||
---|---|---|---|
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
runtimeDPI : Number [唯讀]
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 |
方法 | 定義自 | ||
---|---|---|---|
Constructor. | RuntimeDPIProvider | ||
指出物件是否有已定義的指定屬性。 | Object | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
會傳回指定之物件的基本值。 | Object |
runtimeDPI | 屬性 |
runtimeDPI:Number
[唯讀] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | 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.
實作
public function get runtimeDPI():Number
相關 API 元素
RuntimeDPIProvider | () | 建構函式 |
public function RuntimeDPIProvider()
語言版本: | ActionScript 3.0 |
產品版本: | Flex 4.5 |
執行階段版本: | 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; } } }
Tue Jun 12 2018, 03:47 PM Z