| Package | com.afcomponents.umap.types |
| Class | public class Offset |
To use the Offset class you should first create it's instance where you should specify
x and y offset distance either in pixels or in percent. Then you should use toPoint() method,
where you should pass a Size object with the width & height values of the object you wish to offset.
This method returns Point object with calculated x & y offset distance.
Here is a quick usage example:
import com.afcomponents.umap.types.Offset; import com.afcomponents.umap.types.Size; var offset:Offset = new Offset(10,"50%"); trace(offset); // traces (x=10, y=50%) trace(offset.toPoint(new Size(100,200))); // traces (x=10, y=100)
See also
| Property | Defined by | ||
|---|---|---|---|
| x : String
Gets or sets the horizontal offset either in pixels as a
Number or in percent as a String
| Offset | ||
| y : String
Gets or sets the vertical offset either in pixels as a
Number or in percent as a String
| Offset | ||
| Method | Defined by | ||
|---|---|---|---|
|
Offset(xOffset:*, yOffset:*)
Offset constructor.
| Offset | ||
|
Creates a copy of this
Offset object. | Offset | ||
|
getTypeFromXML(xml:XML):Offset
[static]
Returns new object, which will be constructed from the source XML data.
| Offset | ||
|
getXMLFromType(offset:Offset, name:String):XML
[static]
Returns XML data that describes the Object.
| Offset | ||
|
Returns a
Point object as the result of applying
current Offset to the specified Size object. | Offset | ||
|
toString():String
Returns a
String that represents this object's properties. | Offset | ||
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_NODE_NAME : String = "offset" [static]
Defines default root node name for XML conversion.
| Offset | ||
| x | property |
x:String [read-write]
Gets or sets the horizontal offset either in pixels as a Number or in percent as a String
public function get x():String
public function set x(value:String):void
| y | property |
y:String [read-write]
Gets or sets the vertical offset either in pixels as a Number or in percent as a String
public function get y():String
public function set y(value:String):void
| Offset | () | constructor |
public function Offset(xOffset:*, yOffset:*)Offset constructor.
Constructs an Offset object from specified x and y offset distances.
You can pass either distance as a Number of pixels
or a percentage offset as a String with trailing % sign.
xOffset:* — Horizontal offset.
|
|
yOffset:* — Vertical offset.
|
| clone | () | method |
public function clone():Offset
Creates a copy of this Offset object.
Offset —
A copy of this object.
|
| getTypeFromXML | () | method |
public static function getTypeFromXML(xml:XML):OffsetReturns new object, which will be constructed from the source XML data.
Parametersxml:XML — Source XML data.
|
Offset —
Object that was constructed from the source XML data.
|
| getXMLFromType | () | method |
public static function getXMLFromType(offset:Offset, name:String):XMLReturns XML data that describes the Object. You can also specify root node name in the second parameter.
Parametersoffset:Offset — Object that should be converted to XML.
|
|
name:String — Root node name.
|
XML — XML data that describes the properties of the source object.
|
| toPoint | () | method |
public function toPoint(size:Size):Point
Returns a Point object as the result of applying
current Offset to the specified Size object.
The method will fail if size object has a value of null.
Be sure to validate the result, before using the returned object.
size:Size — Object that holds target width & height
|
Point — Offset point or null if an error occurs.
|
See also
| toString | () | method |
public function toString():String
Returns a String that represents this object's properties.
The output will look like "(x=horizontal offset, y=vertical offset)"
ReturnsString — A textual representation of this Offset object.
|
| DEFAULT_NODE_NAME | constant |
public static const DEFAULT_NODE_NAME:String = "offset"Defines default root node name for XML conversion.