IAT167-Week 4 Lecture 1 and 2.docx

37 views2 pages

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.
Event-driven Programming
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
Interrupts
Event Handling
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
occurs
Event Dispatcher
addEventListener
hasEventListener
removeEventListener
dispatchEvent
willTrigger
Events
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.
Event Listener
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
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$10 USD/m
Billed $120 USD annually
Homework Help
Class Notes
Textbook Notes
40 Verified Answers
Study Guides
1 Booster Class
Class+
$8 USD/m
Billed $96 USD annually
Homework Help
Class Notes
Textbook Notes
30 Verified Answers
Study Guides
1 Booster Class