Search code examples
actionscript-3bitmapsmoothingflash-cc

AS3 | Changing Z property of an image will remove smoothing


I've an image added on stage while setting smoothing property to true. Everything is fine until I'm changing the Z property - it will make my image blury as hell, although the smoothing property is equal to true.

Is there anything I can do?


Solution

  • Not really. When you apply any 3d transformation to a display object (z, rotationX, etc) it will be rendered with the 3d projection renderer which, disappointingly, introduces some blurring. If your object is back to z=0 and you wish to remove the 3d projection completely, set the transform.matrix, which removes the transform.matrix3D and removes any projection rendering blurring.

    For example, the following will make a 3d display object become a 2d display object, removing any 3d projection it had:

    function remove3D(object:DisplayObject):void {
        object.transform.matrix = new Matrix(object.scaleX, 0, 0, object.scaleY, object.x, object.y);
    }