How to set resolution higher on Flex desktop nativ

2019-06-21 13:03发布

问题:

I'm trying to change the resolution for a flex native app (air) app running on a retina macbook. Flex apps in the browser render everything smoothly at 160dpi automatically but if I build the same app as Air install app, it renders at 72dpi and doesn't look as good. I know you can set a resolution in the application descriptor file for a mobile app but this isn't one. Also, I've tried setting the applicationDPI property on the WindowedApplication tag as well with no luck. Any ideas? Thanks...

回答1:

For the record, to enable high resolution rendering in AIR desktop apps running on e.g. Retina Macbook Pros, set <requestedDisplayResolution>high</requestedDisplayResolution> in the <initialWindow> part of your app descriptor XML. Requires Adobe AIR 3.6 or newer.

http://help.adobe.com/en_US/air/build/WSfffb011ac560372f2fea1812938a6e463-8000.html#WSfffb011ac560372f-4cb7055d12d779150e8-8000



回答2:

http://gregsramblings.com/2010/05/06/scaling-an-adobe-air-application-to-fit-multiple-resolutions-and-netbooks/

<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml&quot; width="1019" height="680" scaleX="0.8" scaleY="0.8" applicationComplete="init()" ...>

<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml&quot; width="1019" height="680" preinitialize="initScreenSize()" applicationComplete="init()" ...> ... ... private function initScreenSize():void{ var thisScreen:Screen = Screen.mainScreen; var newScaleX:Number = thisScreen.visibleBounds.width / 1019 * 0.98; var newScaleY:Number = thisScreen.visibleBounds.height / 680 * 0.98; var newScale:Number = Math.min(newScaleX,newScaleY,1); this.scaleX = newScale; this.scaleY = newScale; this.height = this.height * newScale; this.width = this.width * newScale; }

to scale the app based on the user’s resolution. Here’s the code: