TextField.maxhscroll Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
TextField.maxhscroll Property Flash 6

the maximum distance text can be scrolled to the left read-only
theField.maxhscroll

Description

The integer maxhscroll property indicates, in pixels, the maximum distance a field's text can be scrolled horizontally to the left. The maxhscroll property typically is used to detect when text has been moved left as far as it will go, or to force a text field to scroll its maximum distance.

When theField.type is set to "dynamic", maxhscroll tells us how far theField's longest line overflows the right border (when hscroll is 0). When theField.type is set to "input", maxhscroll also includes a small buffer space at the right side of theField, (approximately one-fourth of the field's width). This buffer allows room for user input. When hscroll is equal to maxhscroll, theField's longest line of text appears flush with the right border (minus the buffer space if theField.type is set to "input").

Figure 18-4 depicts maxhscroll for a dynamic text field (one with type set to "dynamic"). Text shown in gray is not displayed in the Flash Player but is shown for expository purposes.

Figure 18-4. The maxhscroll property for a dynamic text field
figs/act2.r04.gif

Figure 18-5 shows maxhscroll for the same field but with its type property set to "input". Note the increase in maxhscroll caused by the type change. The field in Table 18-2 has an hscroll of 150 so that the extra space allotted for user input is clearly visible.

Figure 18-5. The maxhscroll property for an input text field
figs/act2.r05.gif

Example

The following code scrolls title_txt all the way to the right. For a more real-world example of maxhscroll, see Example 18-7 under TextField.hscroll.

this.createTextField("title_txt", 1, 0, 0, 30, 20); title_txt.text = "Welcome to my web site."; title_txt.hscroll = title_txt.maxhscroll;

See Also

TextField.bottomScroll, TextField.hscroll, TextField.maxscroll, TextField.scroll; the FScrollBar component in Appendix G



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net