by Peter deHaan on December 7, 2008
in Label
When building dynamic sites or applications, you may want to load text from an external file instead of hard-coding the text directly into the Flash document. One advantage of dynamically loading content is that you can update the welcome message on your homepage without opening an FLA file, republishing the SWF file or uploading a [...]
Tagged as:
Label,
URLLoader,
URLRequest
by Peter deHaan on December 7, 2008
in Label
Working with embedded fonts in a Label component instance is very similar to working with a TextField instance. The main difference is that instead of using the embedFonts or defaultTextFormat properties of the TextField class, set the embedFonts or textFormat styles. In order to set the Label instance’s anti-alias type, set the antiAliasType property on [...]
Tagged as:
antiAliasType,
embedFonts,
Label,
textFormat
by Peter deHaan on December 6, 2008
in Label
By default, the text in a Label component instance isn’t selectable by the user. If you want to allow a user to select the text in a label, set the label’s selectable property to true.
The following example creates a selectable Label instance by setting the selectable property to true.
Full code after the jump.
Tagged as:
alwaysShowSelection,
Label,
selectable,
setSelection(),
TextField
by Peter deHaan on December 6, 2008
in Label
If you need to display longer amounts of text but don’t want to use a TextArea or TextField, set the label instance’s wordWrap property to true to enable multi-line text labels.
The following example creates a new multi-line label instance by setting the wordWrap property to true. This example sets the height of the Label instance [...]
Tagged as:
autoSize,
Label,
wordWrap
by Peter deHaan on December 6, 2008
in Label
If you do not know the width or length of the text, set the label instance’s autoSize property to one of the constants in the TextFieldAutoSize class. By setting the autoSize property, the label is resized automatically to match the contents.
Note: Whenever a Label instance is resized, the resize event (represented by the fl.events.ComponentEvent.RESIZE constant) [...]
Tagged as:
autoSize,
Label,
resize,
TextFieldAutoSize
by Peter deHaan on December 6, 2008
in Label
In a previous example, “Changing the Label instance’s text in Flash using ActionScript 3.0″, we saw how to set a the text in Label control by setting the text property.
When using the Label component, you aren’t limited to plain-text formatting. By setting the label instance’s htmlText property, you can apply rich, HTML formatting such as [...]
Tagged as:
htmlText,
Label
by Peter deHaan on December 6, 2008
in Label
To change the text of a Label instance, set either the text or htmlText properties. Similar to working with text fields, setting the text property sets the plain-text , and setting the htmlText property sets the HTML formatted text displayed by the Label. For more information on HTML formatted labels, see “Creating an HTML-enabled label [...]
Tagged as:
Label
by Peter deHaan on December 5, 2008
in Label
To create a new instance of the Label class using ActionScript, drag a copy of the component from the Components panel into your current Flash document’s library. Next, import the fl.controls.Label class using the import statement. This step is required because the component files are not implicitly imported, like the other flash.* packages. Once you [...]
Tagged as:
Label
by Peter deHaan on December 4, 2008
in Label
The following example shows how you can display a background color on a Flash ActionScript 3.0 Label control by setting the background and backgroundColor properties on the Label control’s internal TextField.
Full code after the jump.
Tagged as:
background,
backgroundColor,
Label,
TextField