Button.onPress( ) Event Handler

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Button.onPress( ) Event Handler Flash 6; on (press) supported since Flash 2

occurs when the mouse button is clicked while the pointer is over a Flash button
theButton.onPress()    on (press) {     statements }

Description

The onPress( ) event handler executes when the primary mouse button is depressed while the mouse pointer is in the button's hit area. Other mouse buttons (right, middle, scroll, etc.) are not detectable. Note that a "mouseclick" is a two-step process: the mouse button is depressed (press) and then released (release). Button press events are appropriate for radio buttons or weapons firing in a game, but use release events to allow the user to change his mind before releasing the mouse.

Example

cancel_btn.onPress = function () {   // Handle event...   trace("press detected"); };

See Also

Button.onRelease( ), MovieClip.onPress( ); Chapter 10



    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