EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Page 680

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
680 ActionScript classes
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
beginIndex:Number [optional] - An integer that specifies the first character of the desired
text span. If you do not specify
beginIndex and endIndex, the TextFormat is applied to the
entire TextField.
endIndex:Number [optional] - An integer that specifies the first character after the desired
text span. If you specify
beginIndex but do not specify endIndex, the TextFormat is applied
to the single character specified by
beginIndex.
textFormat:TextFormat - A TextFormat object, which contains character and paragraph
formatting information.
Example
The following example sets the text format for two different strings of text. The
setTextFormat() method is called and applied to the my_txt text field.
var format1_fmt:TextFormat = new TextFormat();
format1_fmt.font = "Arial";
var format2_fmt:TextFormat = new TextFormat();
format2_fmt.font = "Courier";
var string1:String = "Sample string number one."+newline;
var string2:String = "Sample string number two."+newline;
this.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.text = string1;
var firstIndex:Number = my_txt.length;
my_txt.text += string2;
var secondIndex:Number = my_txt.length;
my_txt.setTextFormat(0, firstIndex, format1_fmt);
my_txt.setTextFormat(firstIndex, secondIndex, format2_fmt);
See also
TextFormat, setNewTextFormat (TextField.setNewTextFormat method)

Table of Contents

Related product manuals