Instant properties: x

The instant property x corresponds to the x coordinate stored in a point or rect operand.

Declaration

Form 1:

int32 point.x

Form 2:

int32 rect.x

Discussion

In its first form, the read access to this property returns the x coordinate of a point operand. The write access modifies the x coordinate of a point operand. The value of the y coordinate is not affected by the modification. For example:

var point p = <100,200>; // Read the x coordinate var int32 result = p.x; // result = 100 // Modify the x coordinate p.x = 50; // p = <50,200>

In its second form, the read access to this property returns the x coordinate of the origin of a rect operand (means the x coordinate of the rectangle's top-left corner). The write access modifies the x coordinate of a rect operand causing the rectangle to change its horizontal position. The values of other coordinates as well as the size of the rectangle are not affected by the modification. For example:

var rect r = <100,200,150,300>; // Read the x coordinate var int32 result = r.x; // result = 100 // Modify the x coordinate r.x = 50; // r = <50,200,100,300>

Usage in Inspector

When working with Inspector you can easily access, evaluate and modify the x coordinate. For this purpose select in Inspector the desired point property or attribute and click on the small triangle on its left side to expand and display the subordinated values:

Similarly when you have expanded a rect property or attribute you can conveniently inspect and modify the rect's origin position: