PDA

View Full Version : Making a TextField transformable


xemic
11-14-2009, 10:11 PM
Hello,

I have a Sprite and it has a TextField as a child. If that Sprite gets transformed, the TextField does not (at least not how I want it). One way to make it transformable is to turn it into a Bitmap. But when this Bitmap gets transformed, there is no anti-aliasing (or maybe little, it turns out ugly at least). Now I have two questions:
- is it possible to make it have some anti-aliasing?
- is there another way to make a TextField transformable?

Cheers!

EDIT: Yay for Google. Apparently I needed to have a swf have embedded a font and then use
[Embed(source="*location of the swf*", fontFamily="Georgia")]
and somewhere else:
var format:TextFormat = new TextFormat();
format.font = "Georgia";
text.embedFonts = true;
text.antiAliasType = AntiAliasType.ADVANCED;
text.defaultTextFormat = format;

Thanks for your help!

box86rowh
11-14-2009, 10:42 PM
I think you have to use an embedded font to do this

xemic
11-14-2009, 10:51 PM
How do I make a TextField use an embedded font with actionscript when that TextField is made with actionscript as well?

Muhammad1
11-14-2009, 10:59 PM
Hello,

I have a Sprite and it has a TextField as a child. If that Sprite gets transformed, the TextField does not (at least not how I want it). One way to make it transformable is to turn it into a Bitmap. But when this Bitmap gets transformed, there is no anti-aliasing (or maybe little, it turns out ugly at least). Now I have two questions:
- is it possible to make it have some anti-aliasing?
- is there another way to make a TextField transformable?

Cheers!


I think the event function that lets the users transform the text field should know the original size of the textfield, and when the user has resized it, you should accordingly calculate the new *font size* of the fonts and then reset the font size. That's how it happens in Photoshop if you resize the entire image. That way you won't loose anti-aliasing as well.

xemic
11-14-2009, 11:05 PM
Okay, what I actually have is a menu consisting of nodes rotating around a center point. Each node has text under it. Because of the rules of perspective, something that goes into the distance becomes smaller. The node is in fact a class based on a sprite, and it has a textfield as a child. Resizing the node resizes the textfield, but the size of the text inside 'snaps' to certain values which I presume are whole numbers, which looks ugly.
I want it to scale smoothly.

Muhammad, recalculating is not a solution. The sprite is scaled, and with that, automatically its textfield child.