How do you rotate a text field in actionscript 3.0? As soon as I change the rotation property of the text field, it does not display.
for example:
var txtFld:TextField = new TextField();
txtFld.x = 100;
txtFld.y = 100;
txtFld.width = 300;
txtFld.height = 300;
txtFld.text = "Test String";
txtFld.rotation = 90;
addChild(txtFld);
In order to see rotated text, you'll have to embed the font.
an alternative is, to copy the textfield into a BitmapData
using BitmapData::draw
and then creating a Bitmap
containing the result, and adding that one to the display list, instead of the original TextField
...
this has the great advantage, that you don't need to embed the font, which reduces swf filesize ... OTOH, you will lose all of the TextField`'s interactivity, and the swf will need more RAM when playing, but the latter is not too significant ...
for the text to look smooth, set Bitmap::smoothing
to true
... also, it helps, if you render your image at a higher resolution ... pseudo-anti-aliasing, so to speak ... when drawing the text, pass a Matrix
scaled up by factor 2 and scale down the Bitmap
by factor 2 ... that way it'll look better ...
greetz
back2dos
Some more info supporting Christophe Herreman : ActionScript - Rotating Text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With