height property

  1. @override
double height
override

Indicates the height of the display object, in dp. The height is calculated based on the bounds of the content of the display object. When you set the height property, the scaleX property is adjusted accordingly, as shown in the following code:

  var rect:Shape = new Shape();
  rect.graphics.beginFill(0xFF0000);
  rect.graphics.drawRect(0, 0, 100, 100);
  trace(rect.scaleY) // 1;
  rect.height = 200;
  trace(rect.scaleY) // 2;

A display object with no content (such as an empty sprite) has a height of 0, even if you try to set height to a different value.

Implementation

@override
double get height {
  throw 'Use `stage.stageHeight` instead.';
}
  1. @override
void height=(double? value)
override

The height setter is overridden to throw an error since the stage's height is defined by the size of the canvas and cannot be changed directly.

Implementation

@override
set height(double? value) {
  throw 'Cannot set height of stage';
}