
12 Getting Started
Application and container initialization
The initialize event is now dispatched later in the startup and component creation life
cycle. In particular, it is now dispatched after the object’s children have been created. If your
event handler assumes that the object’s children have already been created, you can use the
initialize event. If your event handler requires that the object’s children have been
processed by the LayoutManager class, use the
creationComplete event; for example:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()">
Alpha and scale properties
The scaleX, scaleY, and alpha properties now range from 0.0 to 1.0, rather than 1 to 100.
This is also true for the
Fade.alphaFrom, Fade.alphaTo, Zoom.zoomFrom, and
Zoom.zoomTo properties.
Event.currentTarget
Use the currentTarget property rather than the target property of the Event object. The
Event object now has two properties:
target and currentTarget. The former is the object
that originally dispatched the event, and the latter is the object to which your event handler is
attached. The two are often the same, but they may differ if the event has bubbled up from a
child object.
In most cases, you will want to change the
target property to the currentTarget property,
because the object that was previously the target is now most likely the current target; for
example:
switch (event.currentTarget.className) { ... }
For more information, see “Using the target property” on page 113.
Uninitialized values
Remove checks against the undefined value. In Flex 2, undefined is only for use with the *
(no-type) “type”. Other types can no longer store the
undefined value. If you assign
undefined to other types, it will be coerced into null, NaN, 0, or false. You can use the
isNaN() method to check if a variable is NaN.
If you do not initialize a variable at all, the initial value is different than in Flex 1.x. For more
information, see “Initializing variables” on page 29.
Commentaires sur ces manuels