The following has already been listed as a feature request at Adobe Bug System and is only to illustrate the situation which is basically the lack of badly needed functionality in ActionScript 3.

The problem relates to flash.geom.PerspectiveProjection introduced with the load of native 3D in Flash 10.

The situation

  1. The object is added to the stage with the defined x, y, z, rotationX, rotationY and rotationZ properties.
  2. For a better 3D impression, perspective projection is applied.
  3. After all transformations on-screen size of the object is required.

The code

The code is illustrative and self-explanatory: addPerspective() method adds perspective projection and visibleBitmapBounds() returns a Rectangle with visible bounds of the object.

The result and the problem

Depending on the stage size, the result is the blue 3D-rotated plane in the perspective alongside the traceback:

Plane size: 274x365
Plane bounds: (x=256, y=209, w=274, h=365)
Visible, on-screen bounds of the Plane: (x=258, y=215, w=171, h=287)

Plane size and bounds are correct to what it is without perspective transformations, but they don't help with the size of an object on screen.

So what is currently missing from ActionScript 3 entirely, is the means to get visible bounds of the DisplayObject that has perspective projection. It is especially painful if the object can't be output to stage for measuring (visibleBitmapBounds()).

If any math geniuses have a better way to get visible bounds of the object with perspective projection, you're most welcome to share it!

Related resources: