我用applicationDPI在Flex移動紙牌遊戲:在Flex移動設備中開發時,手機和平板電腦之間的差異如何?
<?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.Menu"
applicationDPI="160"
initialize="init()">
<fx:Style source="Preferans.css" />
<fx:Script>
<![CDATA[
import spark.core.ContentCache;
public static const AVATAR_CACHE:ContentCache = new ContentCache();
public static var SCALE:Number;
public function init():void {
SCALE = runtimeDPI/applicationDPI;
}
]]>
</fx:Script>
</s:ViewNavigatorApplication>
並在此基礎上3米不同的分辨率可提供資產:
<fx:Declarations>
<s:MultiDPIBitmapSource id="BACK"
source160dpi="@Embed('assets/icons/low-res/back.png')"
source240dpi="@Embed('assets/icons/mid-res/back.png')"
source320dpi="@Embed('assets/icons/high-res/back.png')"/>
</fx:Declarations>
而且仍是結果並不好看,當我的例如選擇在Flash生成器4.6在iPad模擬器:
在選擇谷歌Nexus One會產生更好的結果:
在這裏做什麼,用什麼檢測手機VS平板設備?
檢查屏幕分辨率在這裏沒有幫助 - 請參閱上面的iPad示例(低分辨率,但大屏幕)。
還沒有使用的Flex移動,但我pressuming的[功能](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabilities。 HTML)類可以提供一些方便的信息,如'OS,screenResolutionX,screenResolutionY,screenDPI' –
謝謝,但問題是**要尋找什麼**例如,當比較iPad與谷歌Nexus One?(請參閱上面的屏幕截圖) –
手動設置ApplicationDPI會導致一些奇怪的問題;我強烈建議不要設置它。另外,我個人覺得DPI相關的代碼只能在設備上測試;模擬器將返回屏幕的DPI [通常爲72;我認爲]。我建議根據您可用的空間大小和定位您的元素 - 在這種情況下的卡片。 – JeffryHouser