EventHandlersExample

Kind of class:class
Inherits from:none
Version:5 December 2006
Author:Arthur Clemens
Classpath:EventHandlersExample
File last modified:Tuesday, 05 December 2006, 12:29:42
Example of using the setting "Distinguish event handlers". This documentation page was created with the prefixes on, while in the input field.

Note the field header "Events broadcast to listeners": the sends tag descriptions are copied automatically from the method descriptions.
You don't need to write @sends tags in the class description yourself!
Events broadcasted to listeners:
  • onChanged(changedField:TextField):Void When the selection is changed by the program.
  • onChanged (changedField:TextField) : Void
  • SomeEvent with type: QUEUE_STOPPED - when a change of focus is detected
    • Sent when then the queue has stopped.
  • Object with type: message
  • Object with type: click

Summary


Instance methods
  • method_A : Void
    • This method does not receive an event, but sends one.
  • method_B : Void
    • This method sends the same event as method_B.
  • method_C : Void
    • Testing to check if this sends tag is not listed double in the class description.
  • method_D : Void
    • The sends tag can be used with dispatched events as well.
  • method_E : Void
    • Using dispatchEvent with a generic object
  • method_F : Void
    • Automatically filling in "Object of type"...
  • whileSomethingElse (o:Object) : Boolean
    • If you want to use other prefixes for event handlers, add the prefix to the field next to "Prefixes".
Event handlers
  • onData (o:Object) : Boolean
    • A method that starts with "on" in lowercase, followed by an uppercase character.

Instance methods

method_A

function method_A (
) : Void

This method does not receive an event, but sends one. In this example the method uses broadcastMessage to send the message. The # character is used as separator between method and comment.
Events broadcasted to listeners:
  • onChanged(changedField:TextField):Void When the selection is changed by the program.

method_B

function method_B (
) : Void

This method sends the same event as method_B. This tag is listed separately in the class description because the comment is lacking here.
Events broadcasted to listeners:
  • onChanged (changedField:TextField) : Void

method_C

function method_C (
) : Void

Testing to check if this sends tag is not listed double in the class description.
Events broadcasted to listeners:
  • onChanged (changedField:TextField) : Void

method_D

function method_D (
) : Void

The sends tag can be used with dispatched events as well.
Events broadcasted to listeners:
  • SomeEvent with type: QUEUE_STOPPED - when a change of focus is detected
    • Sent when then the queue has stopped.

method_E

function method_E (
) : Void

Using dispatchEvent with a generic object
Events broadcasted to listeners:
  • Object with type: message

method_F

function method_F (
) : Void

Automatically filling in "Object of type"...
The code in this method is dispatchEvent({type:"click"});
Events broadcasted to listeners:
  • Object with type: click

whileSomethingElse

function whileSomethingElse (
o:Object) : Boolean

If you want to use other prefixes for event handlers, add the prefix to the field next to "Prefixes". Separate each prefix with a comma. In this case the input field contained on, while. Spaces in between the prefixes do not matter.

Event handlers

onData

function onData (
o:Object) : Boolean

A method that starts with "on" in lowercase, followed by an uppercase character. This is the default way of writing ActionScript event handlers. Some MM classes also use the prefix "allow".