730
Chapter 7: ActionScript for Flash
Horizontal scrolling is measured in pixels because most fonts you typically use are proportionally
spaced; meaning, the characters can have different widths. Flash performs vertical scrolling by line
because users usually want to see a line of text in its entirety, as opposed to seeing a partial line.
Even if there are multiple fonts on a line, the height of the line adjusts to fit the largest font in use.
Note:
The hscroll property is zero-based—not one-based like the vertical scrolling property
TextField.scroll
.
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;
};
See also
TextField.maxhscroll
,
TextField.scroll
TextField.html
Availability
Flash Player 6.
Usage
my_txt
.html
:Boolean
Description
Property; 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.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...