e.
Click OK.
3.
In the library, right-click the font symbol, and then select Linkage from the context menu.
Flash opens the Linkage Properties dialog box.
4.
Select the Export for ActionScript and Export in first frame options and click OK.
5.
Add the following ActionScript to Frame 1 of the Timeline:
// 1
this.createTextField("thickness_txt", 10, 0, 0, Stage.width, 22);
this.createTextField("lorem_txt", 20, 0, 20, Stage.width, 0);
lorem_txt.autoSize = "left";
lorem_txt.embedFonts = true;
lorem_txt.antiAliasType = "advanced";
lorem_txt.text = "Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.";
lorem_txt.wordWrap = true;
// 2
var style_fmt:TextFormat = new TextFormat();
style_fmt.font = "Times (embedded)";
style_fmt.size = 30;
lorem_txt.setTextFormat(style_fmt);
// 3
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function():Void {
// Values for TextField.thickness can range from -200 to +200.
lorem_txt.thickness = Math.round(_xmouse * (400 / Stage.width) - 200);
thickness_txt.text = "TextField.thickness = " + lorem_txt.thickness;
};
Mouse.addListener(mouseListener);
The first block of code creates two text fields,
positions them on the Stage. The
and populates the text field with a block of text.
true
The second block of code defines a text format with the font face Times New Roman, sets
the font size to 30 pixels, and applies the text format to the
The third, and final, block of code defines and assigns a mouse listener for the
event. When the mouse pointer moves horizontally across the Stage, the
onMouseMove
TextField.thickness
current value of
_xmouse
lorem_txt
property changes between -200 and +200, depending on the
.
and
thickness_txt
text field sets its
embedFonts
lorem_txt
, and
lorem_txt
property to
text field.
Using fonts
405
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?