flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak MS <megharajdee...@gmail.com>
Subject Re: runtimeDPIProvider in mx:Application?
Date Wed, 04 Mar 2015 06:51:43 GMT
Hi Alex,
No luck ;(

I updated to Flex4.14 FP 16 AIR 16.

Sample code that I have been trying:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"
minHeight="600"
               runtimeDPIProvider="AppRuntimeDPI"

creationComplete="application1_creationCompleteHandler(event)">
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            protected function
application1_creationCompleteHandler(event:FlexEvent):void
            {
                ta.text = '';
                ta.text += "Capabilities.screenDPI : "+
Capabilities.screenDPI.toString(); //72 in both normal laptop and HD laptop
                ta.text += "\nCapabilities.screenResolutionX : "+
Capabilities.screenResolutionX.toString();//1600 in normal laptop and 1920
in HD laptop
                ta.text += "\nCapabilities.screenResolutionY : "+
Capabilities.screenResolutionY.toString();//900 in normal laptop and 1080
in HD laptop

            }

        ]]>
    </fx:Script>
    <s:Button label="Hello"/>
    <s:TextInput/>
    <s:DropDownList/>
    <s:Label text="Hello Label"/>
    <s:NumericStepper />
    <s:TextArea id="ta" width="100%"/>
</s:Application>

AppRuntimeDPI.as :

package
{
    import mx.core.DPIClassification;
    import mx.core.RuntimeDPIProvider;

    public class AppRuntimeDPI extends RuntimeDPIProvider
    {
        public function AppRuntimeDPI()
        {
            //super();
        }

        override public function get runtimeDPI():Number
        {
// cannot check for this condition too as screenDPI for any laptop(normal
or HD) is returned as 72 always. Moreover, any DPI value that I assign
here, doesn't have any effect on the screen element sizes. It's always same
for all values.

            // 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;*/
            return DPIClassification.DPI_240;
        }
    }
}


On Tue, Mar 3, 2015 at 10:30 PM, Deepak MS <megharajdeepak@gmail.com> wrote:

> Hmmm okay. I'll give it a try and let you know. Just hope it works.
> On 3 Mar 2015 21:21, "Alex Harui" <aharui@adobe.com> wrote:
>
>> Try the latest AIR SDK?
>>
>> On 3/3/15, 5:28 AM, "Deepak MS" <megharajdeepak@gmail.com> wrote:
>>
>> >
>> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core
>> >/RuntimeDPIProvider.html
>> >I have tried this on Flex 4 application(4.13, FP15, AIR15) and I'm afraid
>> >it isn't working as expected. I tried to create a runtime class and DPI
>> >value was overridden. But still there is no change. All screen elements
>> >look very small than normal.
>> >
>> >Has anybody come across this case on laptops(high DPI\retina display\HD)?
>> >
>> >On iPad retina display, it works out of the box without any
>> >runtimedpiprovider class when I use flex 4.13 but not on this laptop.
>> When
>> >I checked Capabilites.screenDPI, I get the value as 72. Looks like value
>> >returned isn't correct nor is it getting overridden.
>> >
>> >Any ideas?
>> >
>> >PS: I'm testing this on Dell latitude E7440.
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message