Flash builder Mobile AS3 project: Screen DPI, Appl

2019-07-30 12:47发布

问题:

I wrote a Flash Builder project in AS3. It uses some images to tell the user that it is busy with something.

In the first place I wanted to use the SVG file format for these images to keep it crisp as possible. But it doesn't work, errors in shapes or not on the right position.

So I decide to use the PNG format. It is working nicely except for one thing: DPI translations done by the compiler. I cannot center the image because the DPI size is recalculated to the size of the screen's DPI and can be different on devices. This is very complicated to me because I only want to center the image.

The images has 96DPI, The Capabilities object returns a screenDPI of 165. Because width and height doesn't change when DPI changes (object returns same width and height), I cannot see what the REAL size is of the image in pixels (the size the user see).

In this example, the visual size of the bitmap increases and doesn't fit on screen. This makes it very complicated to use images in the project.

The documention on the Adobe site notice about bitmap DPI. And also that the screenDPI could be reported wrong by the OS. The only solution to this, is to include images that matches the screen dpi for every device with a different DPI. Wow, that is very complicated stuf, you can read it here: http://help.adobe.com/en_US/flex/mobileapps/WS19f279b149e7481c682e5a9412cf5976c17-8000.html

Within flex you can set the target DPI (Applications DPI) but how can i do this in an AS3 project? You cannot change it at run-time so how can i do this? In the XML file, i didn't find an option about the application it's initial DPI.

The images are 96 DPI, so when I set the application's DPI to 96 either, iI assume it will be displayed OK? But how do I do this?

Other solutions also very welcome.

Thank you for your time, if you got a question let me know.