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";

var _text2:TextField = new TextField();
_text2.defaultTextFormat = new TextFormat("Arial", 18);
_text2.text = "rotationZ";

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

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s