Datasheet

This ActionScript code accomplishes exactly the same steps as the MXML code in the first example.
Notice that it takes four lines of ActionScript instead of the single line of MXML code. The amount
of code needed to accomplish any particular task is a common difference and one of the reasons
MXML exists. MXML can significantly reduce the amount of code in your application without
compromising its features or performance.
Assuming that the ActionScript code above is in a main application file, the prefix this
in the method call this.addChild() would refer to the Application itself. If the
same code were in an MXML component or ActionScript class,
this would refer to the current
instance of that component or class.
Flex versus Flash development
Developers tend to use Flex instead of Flash when they want to create software applications that
have these characteristics:
High level of interactivity with the user
Use of dynamic data with application servers such as ColdFusion, ASP.NET, PHP, or J2EE
Highly scaled applications in terms of the number of views, or screens, from which the
user can select
In contrast, developers tend to use Flash when they are creating documents with these characteristics:
Documents whose main purpose is to present visual animation
Marketing presentations
Hosting of Web-based video
Many applications that are built in Flash CS3 could be built in Flex, and vice versa. The selection
of development environment, then, is frequently driven by a developer’s background and existing
skill set.
Developing in Flash
As described above, developers who use Flash are frequently focused on presenting animation,
hosting video, and the like. Flash is generally considered superior for animation work because of
its use of a timeline to control presentations over a designated period of time. Flash supports a
variety of animation techniques that make use of the timeline, including these:
Frame by frame animation
Motion tweening
Shape tweening
Flash also allows you to create animations using pure ActionScript code, but that approach also
can be used in Flex. Developers who come from a graphic design background and are used to
thinking visually appreciate the precision and visual feedback that the Flash development environ-
ment provides.
NOTE
NOTE
7
About Flex 3
1
06_287644-ch01.qxp 6/23/08 11:28 PM Page 7