object.xReference

Description:

Retrieve or change the x-position of the reference point relative to the object’s local origin. It is relative to another point in the object, not to its parent. Conceptually, the reference point is the location about which scaling and rotations occur. Sometimes this is referred to as the registration point. For most display objects, this value defaults to 0, meaning the x-position of the origin and the reference point are the same. This merely defines the reference point, so changing the value of this property does not change the position of the object.

Syntax:

local var = object.xReference
object.xReference = value

Example:

local rect1 = display.newRect(0, 0, 50, 50)
rect1:setFillColor(170, 170, 170)
rect1.x = 100
rect1.y = 100
 
local rect2 = display.newRect(0, 0, 50, 50)
rect2:setFillColor(255, 255, 255)
 
rect2.xReference = 50
rect2.x = 100
rect2.y = 100

Returns:

number: The X-reference value for the object.

Remarks:
Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Corona SDK 1.0
  • Windows:
    Corona SDK 2.0
  • iOS:
    Corona SDK 1.0
  • Android:
    Corona SDK 2.0

Replies

info756
User offline. Last seen 2 years 2 weeks ago. Offline
Joined: 7 Mar 2012

Instead of:

Retrieve or change the x-position of the reference point relative to the object’s local origin. It is relative to another point in the object, not to its parent.

it should say:

Retrieve or change the x-position of the reference point relative to the object’s local origin.

(taken from http://developer.anscamobile.com/forum/2011/05/22/confusing-documentation)