AS3 Rotating Text without Embedding Font

So, we have a text field with some format and some text in it. All is good, until we start doing something to that text field. Rotating the text using the rotation property it will make our text to disappear. In Flash Player 9 all we had to do is to embed the fonts in the text field.

With Flash Player 10 instead of rotation, you can apply rotationZ. And here’s a little explanation.

In Flash Player versions prior to Flash Player 10, display objects had two properties, x and y , for positioning them on a 2D plane. Starting with Flash Player 10, every ActionScript display object has a z property that lets you position it along the z-axis, which is generally used to indicate depth or distance.

The only drawback is that using any of the new 3D properties instantly converts your MovieClip into a bitmap (because it uses the Bitmap Transform functions to mimic the 3D distortions). This will make your Vector shapes and Textfields noticeably blurred, especially if zoomed.

Now a little example for you to test. Don’t forget to change the Publish Settings to Flash Player 10 to make this work.

var _text:TextField = new TextField();
_text.defaultTextFormat = new TextFormat("Arial", 18);
_text.text = "rotation";
_text.x=50
_text.y=50;
addChild(_text);

var _text2:TextField = new TextField();
_text2.defaultTextFormat = new TextFormat("Arial", 18);
_text2.text = "rotationZ";
_text2.x=50
_text2.y=150;
addChild(_text2);

_text.rotation = 90;
_text2.rotationZ = 90;

You will notice that the _text’s text wont show up.