PDA

View Full Version : CS3[as3.0]Rotating a TextField that is modified with CSS



Gar_Fonz
June 13th, 2008, 11:29 PM
I was wondering if anyone knows of a way to rotate a textfield that has been modified with CSS. I know that you must embed fonts in order to do this, but, when you try to use both TextFormat and the textField.styleSheet, they cancel each other out/don't operate properly. If I'm out of luck here, I'll just have to lose the CSS styles for the particular textfields that I'm rotating, which is a bummer, since It would suck to not be able to modify them through the external .css file. Does anyone know of a solution?

btw, I'm doing everything with code, and when I try adding the textFields to a sprite, then rotate the sprite, the textFields disappear.

amarghosh
June 14th, 2008, 12:31 AM
u can't use TextFormat on a TextField that is formatted with style sheets. they r mutually exclusive. u can use only one of them; if u r able to display text as intended, embedding fonts should be enough to rotate/scale etc.

Gar_Fonz
June 14th, 2008, 12:42 AM
so far, the only way that I've seen to embed fonts is something like
var font:Font = new Arial();
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = font.fontName;
var txt:TextField = new TextField();
txt.embedFont = true;
txt.defaultTextFormat = myTextFormat;
Of course, that is all after inserting a new font into the library. The only other way to embed fonts (that I know of) is using the textfield property panel. If that is the case, then I need to experiment with textfields placed on the stage, instead of dynamically created textfields ( which is a bit of a work around). Unless there is another way to embed fonts without using the TextFormat class, my only option is to use textFields placed on the stage. although, I've had problems with getting textfields that live on the stage to accept CSS, although I admit I could have had something wrong. Has anyone else gotton textfields on the stage to accept CSS formating?

amarghosh
June 14th, 2008, 12:58 AM
text field on the stage will be having an instance name, right? use it to assign stylesheet.
tf.styleSheet = myStyleSheet;