TextField._xscale Property

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

width of a text field, as a percentage of original read/write
theField._xscale

Description

The floating-point _xscale property specifies the width of theField's bounding box, relative to its original width, expressed as a percentage. The original width is either the width of the field at authoring time or the width most recently specified (via either MovieClip.createTextField( ) or _width). Text in the field is scaled only if embedFonts is true; otherwise, it is not affected by _xscale. This contrasts with _yscale, which always affects theField's text scale. Note that scaling text horizontally but not vertically stretches it disproportionately. Use a TextFormat object for precise control over text's point size.

When the current width of theField is the same as its original width, _xscale is 100. An _xscale of 200 doubles theField's width relative to its original width. An _xscale of 50 halves theField's width relative to its original width.

When _xscale is set to a negative value and embedFonts is true, theField is flipped horizontally, as if across a vertical mirror running along its left edge (i.e., it becomes a mirror image of itself), after which the negative value is treated as a positive. To flip a text field horizontally without resizing it, set _xscale to -_xscale (negative _xscale).

Example

this.createTextField("field1_txt", 1, 0, 0, 200, 20); field1_txt.text = "This is twice as wide."; field1_txt.border = true; this.createTextField("field2_txt", 2, 0, 25, 200, 20); field2_txt.text = "This is backwards!"; field2_txt.border = true; // Double the width of theField_txt field1_txt._xscale *= 2; // Create a mirror image of theField_txt field2_txt._xscale = -field2_txt_xscale;

See Also

MovieClip._xscale, TextField._width, TextField._yscale, the TextFormat class



    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