1186
ActionScript classes
Example
The following example scrolls the
my_txt
text field horizontally using two buttons called
scrollLeft_btn
and
scrollRight_btn
. The amount of scroll displays in a text field called
scroll_txt
. Add the following ActionScript to your FLA or AS file:
this.createTextField("scroll_txt", this.getNextHighestDepth(), 10, 10, 160,
20);
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 30, 160,
22);
my_txt.border = true;
my_txt.multiline = false;
my_txt.wordWrap = false;
my_txt.text = "Lorem ipsum dolor sit amet, consectetuer adipiscing...";
scrollLeft_btn.onRelease = function() {
my_txt.hscroll -= 10;
scroll_txt.text = my_txt." of "+my_txt.maxhscroll;
};
scrollRight_btn.onRelease = function() {
my_txt.h= 10;
scroll_txt.text = my_txt." of "+my_txt.maxhscroll;
};
The
MovieClip.getNextHighestDepth()
method used in this example requires Flash Player
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth()
method.
See also
maxhscroll (TextField.maxhscroll property)
,
scroll (TextField.scroll
property)
html (TextField.html property)
public html : Boolean
A flag that indicates whether the text field contains an HTML representation. If the
html
property is
true
, the text field is an HTML text field. If
html
is
false
, the text field is a non-
HTML text field.
Availability:
ActionScript 1.0; Flash Player 6
Example
The following example creates a text field that sets the
html
property to
true
. HTML-
formatted text displays in the text field.
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160,
22);
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...