MACROMEDIA FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manuel d'utilisateur Page 112

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 184
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 111
112 Events
About events
The following list is a general overview of the changes to the Event model. Review all event
handling in your Flex application by using these guidelines.
All event objects are either of type Event or a subclass of Event. You should explicitly
declare or cast them to their appropriate type.
Use static constants such as MouseEvent.CLICK instead of string literals for the event
type, such as “
click”. For more information, see “Using static constants” on page 114.
Do not use object event listeners. Instead use function listeners. For more information, see
“Using function listeners” on page 115.
Scoping in event listeners is improved. You no longer need to pass a Delegate to maintain
scope.
Use the currentTarget property instead of the target property when you access the
object that is listening for the event. The
target property refers to the object that
dispatched the event.
Subclasses of Event, such as MouseEvent, have all the properties of the Event object and
properties that are specific to that type of event. Choosing the most specific type possible
provides the following benefits:
Faster run-time performance
Compile-time type-checking
Access to event-specific properties
Smaller SWF file size
Component startup life cycle
The ordering of events during a component’s initialization has changed. The initialize
event is now named
preinitialize.
The
initialize event now occurs after children are added to the component. As a result,
instead of calling an event handler for the
creationComplete event, you can use the
initialize event handler to perform most initialization tasks. You typically call
creationComplete when you have to wait until the LayoutManager has processed the
children so that the
x, y, width, and height properties are known.
The
childrenCreated event has been removed. You should use the initialize event
instead.
A new event,
applicationComplete, has been added. This event is the last one dispatched
when an application starts up.
Vue de la page 111
1 2 ... 107 108 109 110 111 112 113 114 115 116 117 ... 183 184

Commentaires sur ces manuels

Pas de commentaire