Packagemx.styles
Classpublic class CSSDimension
InheritanceCSSDimension Inheritance Object

Language Version : ActionScript 3.0
Product Version : Flex 4.13
Runtime Versions : AIR 3.0

Represents a dimension with an optional unit, to be used in css media queries.

Valid units are: no unit px : pixel in : inch cm : centimeter pt : point dp : device independent pixel ( 1 pix at about 160 DPI )



Public Properties
 PropertyDefined By
  pixelValue : Number
[read-only] Dimension converted to actual pixels, considering the current device DPI
CSSDimension
  unit : String
[read-only] Dimension unit, as a string, or empty string if no unit
CSSDimension
  value : Number
[read-only] Dimension value as a number, without the unit
CSSDimension
Public Methods
 MethodDefined By
  
CSSDimension(value:Number, refDPI:Number, unit:String)
Constructor
CSSDimension
  
AIR-only compareTo(other:CSSDimension):int
Compares to another CSSDimension instance.
CSSDimension
  
toString():String
Printable string of the dimension
CSSDimension
Public Constants
 ConstantDefined By
  NO_UNIT : String
[static]
CSSDimension
  UNIT_CM : String = cm
[static]
CSSDimension
  UNIT_DP : String = dp
[static]
CSSDimension
  UNIT_INCH : String = in
[static]
CSSDimension
  UNIT_PT : String = pt
[static]
CSSDimension
Property Detail
pixelValueproperty
pixelValue:Number  [read-only]

Dimension converted to actual pixels, considering the current device DPI


Implementation
    public function get pixelValue():Number
unitproperty 
unit:String  [read-only]

Dimension unit, as a string, or empty string if no unit


Implementation
    public function get unit():String
valueproperty 
value:Number  [read-only]

Dimension value as a number, without the unit


Implementation
    public function get value():Number
Constructor Detail
CSSDimension()Constructor
public function CSSDimension(value:Number, refDPI:Number, unit:String)

Constructor

Parameters
value:Number
 
refDPI:Number
 
unit:String (default = NaN)
Method Detail
AIR-only compareTo()method
public function compareTo(other:CSSDimension):int

Language Version : ActionScript 3.0
Product Version : Flex 4.13
Runtime Versions : AIR 3.0

Compares to another CSSDimension instance. Actual pixel values are used for comparison, so dimensions can have different units.

Parameters

other:CSSDimension — another CSSDimension instance

Returns
int — 0 if both dimensions are of equal value. rounding errors may occur due to conversion -1 if this is lower than other. 1 if this is greater than other.
toString()method 
public function toString():String

Printable string of the dimension

Returns
String — version as a string
Constant Detail
NO_UNITConstant
public static const NO_UNIT:String

UNIT_CMConstant 
public static const UNIT_CM:String = cm

UNIT_DPConstant 
public static const UNIT_DP:String = dp

UNIT_INCHConstant 
public static const UNIT_INCH:String = in

UNIT_PTConstant 
public static const UNIT_PT:String = pt