Skip navigation
Currently Being Moderated

Recompiling framework.swc

Aug 3, 2013 8:28 AM

Tags: #air #flex-mobile #flex4.6

In order to solve the DPI problem (see my last topic),I decided to see the sdk source code.


I found changing , , and file is the key to my problem ,so I changed the classifyDPI method in file :


mx_internal static function classifyDPI(dpi:Number):Number


        if (dpi < 200)

            return DPIClassification.DPI_160;      

        if (dpi <= 280)

            return DPIClassification.DPI_240;

//   ↓↓    ↓↓  ↓↓ I changed  this ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

          if(dpi <= 360)

             return DPIClassification.DPI_320;


          return DPIClassification.DPI_400;



then I added DPIClassification_DPI_400 = 400 in file


In , I changed the getDPIScale method like this:


public static function getDPIScale(sourceDPI:Number, targetDPI:Number):Number


        // Unknown dpi returns NaN

        if ((sourceDPI != DPIClassification.DPI_160 && sourceDPI != DPIClassification.DPI_240 &&

  sourceDPI != DPIClassification.DPI_320 && sourceDPI != DPIClassification.DPI_400||

            (targetDPI != DPIClassification.DPI_160 && targetDPI != DPIClassification.DPI_240 &&

  targetDPI != DPIClassification.DPI_320 && targetDPI != DPIClassification.DPI_400))


            return NaN;



        return targetDPI / sourceDPI;



Now it seems that  I can handle DPI problem by changing all these files.


BUT,there's a new problem, I have to recompile  framework.swc file to get these things work. If anyone have done this before?


If these methods can be overrided in my application ,then how ?

  • Currently Being Moderated
    Aug 3, 2013 9:25 AM   in reply to hubcin

    > If these methods can be overrided in my application ,then how ?



    Google this:


    ActionScript "Monkey Patch"



    Much easier than recompiling the Flex source. 

    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 10:03 AM   in reply to hubcin

    Hello, hubcin.


    I have the same problem than you, good although I see you've solved ...

    Can you give me specific instructions how i must to do?


    Thank you.


    Best Regards.

    Mark as:
  • Currently Being Moderated
    Aug 6, 2013 8:24 AM   in reply to hubcin

    Ok. First many Thanks for your patience.


    But I need to put all the code in, and for the other: , and and after make your corrections?


    Can yo send me by email this folder.


    I will be obliged greatly.


    Thank you again.

    Mark as:
  • Currently Being Moderated
    Aug 6, 2013 10:21 AM   in reply to hubcin

    Many, many Thanks.


    It works perfectly.


    Now I must to do all the modifcations in App (resources), but detection of DPI works correctly.


    Best Regards and Thank you again.

    Mark as:
  • Currently Being Moderated
    Aug 6, 2013 11:35 AM   in reply to mfdezpo

    There is another thing to do and is to modify inside spark/utils the same mode.


    Note: There is a small error in name of -> at the beginning of post.


    Thanks a lot again.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points