For unlimited access to Class Notes, a Class+ subscription is required.
Week 4 Lecture 1 and 2
Event Driven Programming and Game Difficulty
An event is a notification that occurs in response to an action, such as a change in state, or as a
result of the user clicking the mouse or pressing a key while viewing the document.
Programming paradigm in which the program flow is determined by events
An architecture where the application has a main loop divided into two sections:
Event Selection / Detection
Event Dispatcher – the Event Source or Provider, the sender of the event
Event – the object sent
Event Listener or Consumer – the receiver of events
Handler / Listener Function - a function that receives control when the corresponding event
bubbles : Boolean
Indicates whether an event is a bubbling event.
cancelable : Boolean
Indicates whether the behavior associated with the event can be prevented.
currentTarget : Object
The object that is actively processing the Event object with an event listener.
eventPhase : uint
The current phase in the event flow.
target : Object
The event target.
type : String
The type of event.
Asynchronous Callback subroutine
You can have multiple Event Listeners on one Event Dispatcher
Can be listening for the same event or different events
Manage and clean-up Event Listeners