Button._width Property

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

width of the button, in pixels read/write
theButton._width

Description

The floating-point _width property stores a nonnegative number specifying the current width of theButton, in pixels. If theButton has no content, _width is 0. The _width property measures the content of a button as the distance between the leftmost occupied pixel and the rightmost occupied pixel, even if there is empty space between those pixels. By setting _width, we change the size of theButton, affecting all of its states (its Up, Over, and Down frames). Note that the _width of a button can change as it switches between these states.

Button._width is directly analogous to MovieClip._width; see that property entry for full details.

Example

// Check start_btn's width trace(start_btn._width);     // Set start_btn's width to 200 start_btn._width = 200;     // Create a text field 10 pixels to the right of start_btn, assuming // that start_btn's top left corner is at the registration point start_btn._parent.createTextField("theField_txt",                                    1,                                    start_btn._x + start_btn._width + 10,                                    start_btn._y,                                    200, 20); theField_txt.border = true; theField_txt.text = "Click the button to start.";

See Also

Button._height, MovieClip._width



    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