×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2014.2381 | Released: 30 Jul 2014, 6:32am | What's New | Download Now

object.contentBounds

Description:

A table with properties xMin, xMax, yMin, yMax in screen coordinates.

Equivalent to object.stageBounds, which is deprecated.

Syntax:

object.contentBounds

Example:

local rect = display.newRect(100, 100, 50, 50)
rect:setFillColor(170, 170, 170)
 
local bounds = rect.contentBounds 
print("xMin: ".. bounds.xMin) -- xMin: 100
print("yMin: ".. bounds.yMin) -- yMin: 100
print("xMax: ".. bounds.xMax) -- xMax: 150
print("yMax: ".. bounds.yMax) -- yMax: 150

Parameters:

 

Returns:
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

dgaedcke
User offline. Last seen 17 hours 13 min ago. Offline
Joined: 17 Apr 2010

It's unclear from the docs if contentBounds is read-only, or if it can be used as a quick way to change the group location/size.

The answer is no...it is read-only