2 Replies Latest reply on May 3, 2011 10:59 PM by S k R Pasha

    change resolution based on dpi in flex

    S k R Pasha

      Hi All ,

       

          In my Flex Application , i am getting image for chart / process from java. Its working fine.

       

      Now my new requirement is :

       

      1) For the first time when getting image the default dpi should be  : 72dpi

      2) And i should have 2 more options to select 90dpi and 150dpi in flex

       

         and when selecting these dpis , my chart/process resolution should change based on selected dpi in Flex.

       

      Please helpp.....

        • 1. Re: change resolution based on dpi in flex
          matthew horn Level 3

          SkR Pasha,

           

          If I understand what you mean, there are two approaches you can take:

           

          1) The easiest way is to just define 3 paths to images, each one being a different resolution:

          var img1:String = lowResImage.gif;

          var img2:String = medResImage.gif;

          var img3:String = highResImage.gif;

           

          Then load the one that is appropriate when the DPI changes.

           

          2) Flex 4.5 includes support for multiple DPIs. First you get the current DPI:

          FlexGlobals.topLevelApplication.applicationDP
          
          Then you use the MultiDPIBitmapSource class to specify which image to use based on the DPI.

           

          Here's an example that you can apply to a standard application (you don't need to write a mobile app to do it):

          http://help.adobe.com/en_US/flex/mobileapps/WS19f279b149e7481c682e5a9412cf5976c17-8000.htm l

           

          hth,

          matt horn

          flex docs

          1 person found this helpful
          • 2. Re: change resolution based on dpi in flex
            S k R Pasha Level 1

            Thanks ,

             

            But i am using Flex 3...

             

            Here is my code :


            var img:Image;
            img.source=processUrlString+"&width="+imagewidth+"&height="+imageheight;


            Here  processUrlString = "/dashboard/servlet/processmap.do" ( ie i am calling java url ..which creates chart and  reurns byte[]s to flex. And i am adding this image to Panel in Flex.

            Here .. i want to set Image DPI like 75dpi or 90dpi etc.... by selecting the dpi from Combobox[Drop down B ox]

             

             

            thanks in advance...