AS3 - Why is my transform.matrix3D null?

I have a class named Box that extends Sprite and when I'm trying to access his transform.matrix3D property (indeed is the matrix3D property from an Transform object) this returns me null. Why?

package some.place
{
    // ... imports ...

    public class Box extends Sprite
    {
        public function Box() {}

        public function DoSomething():void
        {
            var m:Matrix3D = transform.matrix3D;
            // here m == null !!! Why???
        }
    }
}

Upvotes: 1

Views: 1195

Answers (1)

Patrick
Patrick

Reputation: 15717

By default 2D object have no matrix3D, i.e. if you have not use any 3D stuff (z property, rotationY,etc ...) with your DisplayObject you will have a null matrix.

N.B. You can also set the matrix3D to null to reset back you object in 2D

The value of the z property of a 2D object is zero and the value of its matrix3D property is null.

Upvotes: 2

Related Questions