About text layout and formatting 415
To modify a text field’s sharpness and thickness:
1. Create a new Flash document and save it as sharpness.fla.
2. Select New Font from the pop-up menu in the upper-right corner of the Library panel.
3. Select Arial from the Font drop-down menu and set the font size to 24 points.
4. Enter the font name of Arial-24 (embedded) in the Name text box and click OK.
5. Right-click the font symbol in the library and select Linkage to open the Linkage Properties
dialog box.
6. Set the linkage identifier to Arial-24, select the Export for ActionScript and Export in First
Frame check boxes, and click OK.
7. Add the following code to Frame 1 of the main Timeline:
var my_fmt:TextFormat = new TextFormat();
my_fmt.size = 24;
my_fmt.font = "Arial-24";
this.createTextField("lorem_txt", 10, 0, 20, Stage.width, (Stage.height
- 20));
lorem_txt.setNewTextFormat(my_fmt);
lorem_txt.text = "loading...";
lorem_txt.wordWrap = true;
lorem_txt.autoSize = "left";
lorem_txt.embedFonts = true;
lorem_txt.antiAliasType = "advanced";
this.createTextField("debug_txt", 100, 0, 0, Stage.width, 20);
debug_txt.autoSize = "left";
debug_txt.background = 0xFFFFFF;
var lorem_lv:LoadVars = new LoadVars();
lorem_lv.onData = function(src:String) {
lorem_txt.text = src;
}
lorem_lv.load("http://www.helpexamples.com/flash/lorem.txt");
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function():Void {
lorem_txt.sharpness = (_xmouse * (800 / Stage.width)) - 400;
lorem_txt.thickness = (_ymouse * (400 / Stage.height)) - 200;
debug_txt.text = "sharpness=" + Math.round(lorem_txt.sharpness) +
", thickness=" + Math.round(lorem_txt.thickness);
};
Mouse.addListener(mouseListener);