Developer Resources

Event

Overview

The Event class represents an event.

Constructor

Event()

Methods

Event.connect
Connects an event to a function.
Event.disconnect
Disconnects a specific event handler
Event.disconnectAll
Disconnects all event handlers.
Event.fire
Connects an event to a function.
Event.getSinkCount
Returns the number of event handlers
Event.isConnected
Determines if the event is handled

Event.connect

function Event.connect(func : Function)
function Event.connect(object : Object, func : Function)

Arguments

func
The function to which to connect the event.
Param
Param

Description

Connects an event to a function specified by func or by object and func. For example, for a size event, this.size.connect(onFormResized) will connect the size event to the onFormResized function, such that onFormResized will be invoked when the size event occurs. Similarly, this.size.connect(this, onFormResized) will connect the size event to the onFormResized function using the this pointer specified in the object parameter

Event.disconnect

function Event.disconnect(func : Function) : Boolean
function Event.disconnect(object : Object, func : Function) : Boolean

Returns

True if the event handler was successfully found and removed, false otherwise

Description

Calling this method disconnects the specified event handler from the event object. When the event is subsequently fired, the specified handler will no longer be invoked. If the handler was found and removed by the disconnect() method, true is returned. If the handler was not found, false is returned.

Event.disconnectAll

function Event.disconnectAll()

Description

Disconnects all event handlers from the event. When the event is subsequently fired, any previous event handlers will no longer be triggered

Event.fire

function Event.fire(sender : Object, event_args : Object)

Arguments

sender
A reference to the sender of the event
event_args
An object containing event arguments specific to the event

Description

Fires an event. The parameters passed to this method will be passed on to the event sink(s).

Event.getSinkCount

function Event.getSinkCount()

Returns

An integer value indicating the number of event handlers

Description

This method returns the number of event handlers (sinks) attached to the event. This normally corresponds to the number of times the connect() method was called

Event.isConnected

function Event.isConnected()

Returns

True if the event is handled, false otherwise

Description

This method allows the caller to determine if the event is handled. If the event is handled by one or more handlers, the function will return true.