Prev | Current Page 697 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

haXe does not have a
standard API to deal with generic events, but on the haXe site there is a proposal by the very same
author of the language, Nicolas Cannasse. The system is dead simple but effective, too: The events are
not based on strings and, thus, the compiler can fully check their types for correctness and events can be
created with just one line of code. The event proposal can be found at the following address: www.haxe
.org/proposals/events .
The main type in the system is the class Dispatcher < EventType > ; the type argument EventType is a
definition for an object that is passed as an argument along with the event. In the case of a click event,
the EventType can be an object of type MouseEvent that can contain the coordinates of the cursor on the
screen and other mouse - related information. To know more about the event systems, refer to the
??? Events ??? section of Chapter 12 . Table 13 - 2 describes the methods for the Dispatcher class.
Part II: Server Side, JavaScript, and Flash: Oh My!
372
The events that are really important in a UI are mainly those related to the mouse and the keyboard
activities.


Pages:
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709