EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Getdepth (Textfield.getdepth Method)

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...
658 ActionScript classes
Example
In this example, you need to create a dynamic text field called
my_txt, and then use the
following ActionScript to embed fonts and rotate the text field. The string
my font refers to a
font symbol in the library, with the linkage identifier name
my font. The example assumes
that you have a font symbol in the library called
my font, with linkage properties set as
follows: the identifier set to
my font and Export for ActionScript and Export in First Frame
selected.
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "my font";
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160,
120);
my_txt.wordWrap = true;
my_txt.embedFonts = true;
my_txt.text = "Hello world";
my_txt.setTextFormat(my_fmt);
my_txt._rotation = 45;
getDepth (TextField.getDepth method)
public getDepth() : Number
Returns the depth of a text field.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
Number - An integer.
Example
The following example demonstrates text fields residing at different depths. Create a dynamic
text field on the Stage. Add the following ActionScript to your FLA or ActionScript file,
which dynamically creates two text fields at runtime and outputs their depths.
this.createTextField("first_mc", this.getNextHighestDepth(), 10, 10, 100,
22);
this.createTextField("second_mc", this.getNextHighestDepth(), 10, 10, 100,
22);
for (var prop in this) {
if (this[prop] instanceof TextField) {
var this_txt:TextField = this[prop];
trace(this_txt._name+" is a TextField at depth: "+this_txt.getDepth());
}
}

Table of Contents

Related product manuals