MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 1368

Components language reference
Table of Contents

Advertisement

Description
Method; creates a
TextField
object to display text in the component while inheriting sizing and style methods and
properties of the component. This method is used to create new components. The TextField
that is created is the same as a
MovieClip.createTextField(),
and methods from the parent UIObject.
A TextField that uses
advantage of the following inherited UIObject methods to set sizing and styles within the
context of the parent UIObject:
TextField.getPreferredHeight() : Number
TextField.getPreferredWidth() : Number
TextField.setStyle( styleName : String, value )
TextField.setSize( width : Number, height : Number)
TextField.setValue( text : String )
TextFields created with UIObject.createLabel() have an initial
TextField._visible property of false. This property is used to avoid flickering
that may occur while UIObject.setSize() is called by the parent component. The
TextField._visible property is set to true when the UIObject.draw() is called
after the parent component's children objects are resized.
For more information, see the MultilineCell.as file example in
on page
112.
Example
The following example creates a TextField instance called
component's
UIComponent.createChildren()
public function createChildren():Void {
var myTextField_txt:TextField = this.createLabel("multiLineLabel", 900,
"Hello World");
// Set the fontSize style attribute of the TextField.
myTextField_txt.setStyle("fontSize", 18);
// Set the TextField's initial size.
myTextField_txt.setSize(myTextField_txt.getPreferredWidth(),
myTextField_txt.getPreferredHeight());
// Set the TextField's initial location in the center of the Stage.
myTextField_txt._x = (Stage.width/2) - (myTextField_txt._width/2);
myTextField_txt._y = (Stage.height/2) - (myTextField_txt._height/2);
}
1364
UIObject class
subobject. Used by most components to get a lightweight text
object created using
TextField
but has the added benefit of inheriting useful properties
UIObject.createLabel()
to create within a component can take
"Simple cell renderer example"
multiLineLabel
method
:
within a

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents