<< Chapter < Page Chapter >> Page >

Guarding against nonsensical combinations

How can you determine which combinations of classes and event types make sense and which do not?

As usual, your best friend is the documentation. For example, the ActionScript 3.0 Reference for the Adobe Flash Platform allows you to click on aclass name in the leftmost frame and read about that class in the rightmost frame. For every class that supports events, there is a hyperlink at thetop of the rightmost frame labeled Events . Clicking on that hyperlink will expose all of the event types supported by objects of the classbeing viewed.

SolidColor events

For example, objects of the SolidColor class support only two types of events:

Although you may be able to register event handlers for other types of events on an object of the SolidColor class, it doesn't make any sense to do so. The documentation tells us that there is no point in registering a MouseEvent.CLICK event on a SolidColor object.

The ACTIVATE and DEACTIVATE event types

Both of these event types are defined in the EventDispatcher class and are inherited by all classes whose objects have the ability to dispatch events (other than subclasses of the Proxy class that I am ignoring in this lesson) . They are both dispatched by the system as the result of certain runtime conditions that may be beyond the direct control of the user.I will explain a sample program later that uses these two event types.

The Flex Builder IDE is also helpful

Other useful tools for avoiding nonsensical combinations of classes and event types are the Flex Builder 3 and Flash Builder 4 IDEs. The IDEs provides popup hints at variouspoints as you type ActionScript code. In some cases, the popup hints will list the types of events supported by the object on which you are registering anevent listener.

The DisplayObject class

Of the large number of immediate subclasses of the EventDispatcher class, the one that will probably garner most of your attention in your earlyActionScript programming experience is the class named DisplayObject . According to the documentation:

"The DisplayObject class is the base class for all objects that can be placed on the display list. The display list manages all objects displayedin Flash Player or Adobe AIR."

Flex components

All of the objects with which the user can have direct interaction are instantiated from subclasses of this class. For example, I believe thatall of the components that appear in the Components tab in the Design view of Flex Builder 3 or Flash Builder 4 are subclasses of the DisplayObject class.

I also believe that all of those classes are grouped into packages such as the following:

  • mx.controls
  • mx.containers
  • mx.modules
  • mx.charts

There are about sixty-five classes in the Components tab of Flex Builder 3, and those are the classes that usually involve direct userinteraction. That leaves many more classes that support events that don't usually involve direct user interaction.

Events that don't involve direct user interaction

Questions & Answers

what is variations in raman spectra for nanomaterials
Jyoti Reply
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

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?