MovieClip._xscale Property

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

width of a clip or movie, as a percentage read/write
mc._xscale

Description

The floating-point _xscale property specifies the width of mc, relative to its original width, expressed as a percentage. If mc is an instance, its original width is the width of the instance's symbol in the Library. If mc is a main movie, its original width is the width of the movie at authoring time.

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

The _xscale property scales a clip proportionately on the right and left sides of its registration point. To size a clip from one side only, place all of the clip's content on one side of the registration point in the clip's symbol (this is a useful technique for creating horizontal preloader bars). When a clip's _xscale is set to a negative value, the clip is flipped horizontally, as if across a vertical mirror running through its registration point (i.e., it becomes a mirror image of itself), after which the negative value is treated as a positive. To flip a clip horizontally without resizing it, set the clip's _xscale to -_xscale.

Example

// Double the width of ball_mc (the height remains unchanged) ball_mc._xscale *= 2;     // Create a mirror image of ball_mc ball_mc._xscale = -ball_mc._xscale;

See Also

MovieClip._yscale



    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