PDA

View Full Version : TextInput with rotation doesn't display text


ryryguy
10-24-2007, 05:37 PM
It seems that if you have a TextInput (or TextArea) component and rotate it, the text stops displaying. Anyone know anything about this? Is there a trick or work-around if you want to use one of these but rotate it?

atomic
10-24-2007, 05:51 PM
Have you embedded the font?

ryryguy
10-24-2007, 08:26 PM
No, I haven't embedded the font.

But it's a font that I have on my machine. I can rotate static text that is using the same font and there is no problem.

tg
10-24-2007, 08:38 PM
if it is a dynamic text box, you will need to embed the font.

ryryguy
10-24-2007, 09:02 PM
Huh, strange... only if it's rotated? 'Cause it works fine without the embedded font with a non-rotated component.

I embedded the font and it's still not working. Do I need to explicitly reference the embedded font in the TextFormat of the component somehow? What do I reference there - the symbol name, export class name, what?

tg
10-24-2007, 09:03 PM
yup. for the rotation.

ryryguy
10-24-2007, 09:10 PM
Huh, I still cannot get it to work. I created a Font symbol in the library. It is exported to ActionScript and I'm passing the exported name to a TextFormat as the font name.

Does it have to have runtime sharing enabled or something? Which would be obnoxious since I just want to use it from within the same FLA. Can I somehow share it to itself?

ryryguy
10-25-2007, 02:36 AM
Okay... I figured out how to do this with straight-up dynamic text added with the text tool. Setting the embed on its properties there works as you all have suggested.

I still can't figure out exactly which hoops to jump through to get it to work for the text field that lives inside a TextInput or TextArea component, though. Actually I think the standalone input text object should be good enough for my purposes, but I'm still curious about how to set it up with a component - is it possible?

atomic
10-25-2007, 03:33 AM
You can do it in the same manner with a TextInput component, i.e. with an off-stage textfield (unseen), in which you'll embed the same font used in the component...

myInput.fontFamily = "Courier New";
myInput.fontWeight = "bold";
myInput.embedFonts = true;
myInput.fontSize = 20;
myInput._rotation = -90;

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002480.html

LiorGonnen
11-18-2007, 07:05 AM
Hi, see my post on rotating text without embedding fonts:
http://liorgonnen.blogspot.com/2007/11/rotating-text-in-actionscript-3-without.html

The idea is very simple: A text rendering component (Label, in my post) automatically renders itself as a bitmap, and draws the bitmap back onto itself. Since the component is rotated, the bitmap will be rotated as well.