ButtonEvent Documentation

Author: Trevor McCauley
Last Modified: 4/05/08 3:16:02


Summary

ButtonEvent class:

- description

ButtonEvent Properties:

- type
- target
- currentTarget
- mouseWithin
- pressed
- trackAsMenu
- overlapBlocksEvents

ButtonEvent Methods:

- stopPropagation
- addEventListener
- removeEventListener
- handleEvent


ButtonEvent class

version: 0.9.7

description:

The ButtonEvent class defines event objects used by ButtonEventHandler. ButtonEvent instances contain properties regarding movie clips handled by ButtonEventHandler and manages the events they receive. These instances are created by ButtonEventHandler and returned from a call to ButtonEventHandler.initialize. It is also the object provided to event handlers and provides information regarding the event and the state of the movie clip receiving it. Other objects can be set to listen to events handled by ButtonEvent instances using addEventListener.


ButtonEvent Properties:

type

A String spcifying the current event. This will be either: onPress, onRelease, onReleaseOutside, onRollOver, onRollOut, onDragOver, onDragOut, or onMouseWithin.

target

The movie clip associated with this button event

currentTarget

The first movie clip that initially encountered the current event.

mouseWithin

Specifies whether or not the mouse is within the current target.

pressed

Specifies whether or not the mouse is down and the current target has been pressed.

trackAsMenu

Determines whether or not the target will behave as a menu where it can receive events despite another movie clip having already been pressed (similar to Button and MovieClip trackAsMenu property).

overlapBlocksEvents

Determines whether or not overlapping prevents events for objects in the same timeline (no parent/child relationships) under the target clip for this ButtonEvent instance from triggering. If true, the behavior is like that of normal Flash buttons where buttons above other buttons, prevent the buttons below from receiving events. Note that this property only pertains when ButtonEventHandler.overlapBlocksEvents is false.


ButtonEvent Methods:

stopPropagation

description: Used to prevent events from bubbling to parent movie clips. The event stopped is the current event as specified in this ButtonEvent's type property. This method would most commonly be used within an event handler for an event captured by ButtonEventHandler.

usage: myButtonEvent.stopPropagation();

parameters:

returns: No return specified

addEventListener

description: Registers a listener object with this ButtonEvent instance that is broadcasting an event (from the target movie clip). When the event occurs, the listener object or function is notified.

usage: myButtonEvent.addEventListener(event:String, listener:Object);

parameters:

returns: nothing.

removeEventListener

description: Removes a listener from receiving events from this ButtonEvent instance.

usage: myButtonEvent.removeEventListener(event:String, listener:Object);

parameters:

returns: nothing.

handleEvent

description: Define your own handleEvent handler to manage events sent to the target movie clip. The handleEvent handler can be defined to a ButtonEvent object (received from calling ButtonEventHandler.getEventObject(target)) or to the target movie clip. It will be called every time an event is triggered.

usage: myButtonEvent.handleEvent = function(event:ButtonEvent){ ... };

parameters:

returns: nothing.