Hello Erik,

real world units are no problem in css/javascript allowing "cm". In Flex the problem is that the Flash Player does not offer proper DPI (as you mentioned). That means we need "workarounds" it can be implemented within the Web using ExternalInterface - a JavaScript bridge. It can be implemented in AIR using NativeExtensions. There is just no standard solution for that available in Flex.....

yours
Martin.

On 27/02/2012 06:43, Erik Lundgren wrote:
Dear list,

I would like to spend some time thinking about the "high level" concepts in 
flex – the present and the not yet present.

As I scribble in my notebooks my first halt seems to be the methodology used 
for UI-measurement, and I need some community input:


Should Flex measure layouts in "real world units" or "device units"?


USE CASE PROBLEM

UI layouts * should be tuned to the human motoric and sensory systems. This can be achieved through 
the use of "real world units" (myTouchButton always renders as 0.5 cm x 0.5 cm). If UI 
elements are laid out using "device units" (eg pixels) different screen densities 
distorts the layout experience as layouts are reused across screens (or print).

* Layout = element size and position (and layering?).


PREFERRED SOLUTION

Compose layouts using some "real world unit" (I would promote points). Have Flex read the 
pixel density of the runtime screen and transpose the layout to "device units" (eg 
Pixels).


PROBLEMS IMPLEMENTING THE SOLUTION

The unit-translation-concept is present in flex today through the 
applicationDPI property on Application, but its implementation is not exact and 
based on the precondition that the FLEX can read correct screen ppi values from 
its runtime. Sadly, this is not always the case.

Present runtime: The flash class Capabilities seems to be reading the operating systems 
abstractions of "real world units". On my computer (mac) flash reads the screen 
ppi value as 72 px/inch. In reality my screens density is 113 px/inch. This problem seems 
to be present on windows and mobile operating systems as well.

Possible future runtimes: On the HTML/CSS stack new "resolution" media queries seems to 
be implemented. On the "native" stacks implementations seems to be able to read the 
correct screen ppi values, though the web is full of issues with broken values returned by drivers 
etc.


If there is no way to implement the unit-translationsolution described above, 
Flex should implement some other concept for laying out UI elements.

I've done research but some community input would be great: Can we find 
reliable bridges between flex and the ppi values of the screen that renders it? 
Thoughts?

All the best
/Erik


Reply via email to