<< Chapter < Page Chapter >> Page >

Supplemental material

I recommend that you also study the other lessons in my extensive collection of online programming tutorials. You will find a consolidated index at www.DickBaldwin.com .

General background information

The ActionScript 3.0 Reference for the Adobe Flash Platform is a voluminous document. Understanding ActionScript events on the basisof that document alone can be a daunting task.

There are two entry points into the documentation that can make it somewhat easier to navigate:

The flash.events.Event class

As I understand it, all possible ActionScript events are represented by subclasses of the flash.events.Event class. That class has approximately eighty subclasses, many of which are further extended into additional subclasses.

The flash.events.MouseEvent class

For example, the flash.events.MouseEvent class has eight subclasses, some of which are extended into other subclasses.Therefore, the total number of subclasses of the Event class may be well in excess of one hundred. This means that there may be more than onehundred different types of events being dispatched during the running of an ActionScript program.

Event types and subtypes

An ActionScript class represents a type . Therefore, each subclass of the Event class defines a different type of event. Many subclasses define a large number of subtypes.

For example, the MouseEvent class defines about seventeen subtypes ranging in alphabetical order from CLICK to ROLL_OVER , including MOUSE_MOVE , MOUSE_DOWN , MOUSE_UP , etc.

(For brevity, I will refer to the subtypes as types for the remainder of this document.)

Hundreds of event types and hundreds of object types

Therefore, there are many hundreds of different types of events that can bedispatched in various combinations by hundreds of different types of objects during the running of an ActionScript program.

The DisplayObject class

Objects of some classes (such as Button ) , which are subclasses of the DisplayObject class, can dispatch events as a result of direct user interaction. Forexample, a user can click on a button and cause a click event to be dispatched.

The URLLoader class

Objects of other classes (such as URLLoader ) , which are not subclasses of the DisplayObject class, cannot be caused to dispatch an event as a result of direct userinteraction. (As far as I know, there is no way for a user to interact directly with an object of the URLLoader class.)

However, an object of the URLLoader class can dispatch nine different types of events ranging in alphabetical order from activate to securityError .

The addEventListener methods

The documentation index for Flex Builder 3 lists eight different versions of the addEventListener method in classes plus one that is declared in an interface. Of theeight versions defined in classes, one is defined in the EventDispatcher class. That is the one that I will concentrate on in this lesson.

For the record, however, four of the eight versions are overridden versions of the method that is defined in the EventDispatcher class. The remaining three of the eight are defined in classes that extend the Proxy class, which I will ignore in this lesson.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask