
About the Flex coding process 69
Moving to Flex from an HTML templating
environment
In contrast to environments like JSP, ASP, and ColdFusion, Flex is not a templating system.
MXML files are not templates that contain rules processed on the server to return a filled-in
template. Instead, MXML code is compiled into a fully formed client application that is able
to process server-side logic, and change what is displayed using its own client-side logic.
A Flex application does not go to the server every time the user interface must change or an
event must be handled. Presentation logic and logic for server-side requests and responses is
executed on the client as part of your application’s SWF file. In Flex, changes to the user
interface occur on the client, based on client-side code execution.
A Flex application makes HTTP requests to contact external data services, such as web
services; this interaction with the server does not require you to refresh the application.
Moving to Flex from Flash Professional
Developing a Flex application is different from developing an application in Macromedia
Flash Professional 8 from Adobe, even though in both environments the application is
compiled into a SWF file. You create a Flex application in text files, which you can create and
edit in a simple text editor or a more sophisticated development environment, such as Flex
Builder. You compile your application into a SWF file, and then publish the application on a
web or application server.
You create a Flash document file (a FLA binary file) in the Flash Authoring environment, and
save it as a SWF file before publishing it to a website; it is usually referenced inside an HTML
page. Flash Professional uses concepts such as the Timeline, animation frames, and layers for
organizing and controlling an application’s content over time. In Flex, you write the
declarative parts of an application, such as user-interface components and connections to data
sources, in MXML tags. You must use the tags in the proper hierarchy within the application,
but there is no external notion of Timelines, frames, or layers. Just by using a few MXML
tags, you can create a useful application with built-in behavior.
Although the development models for Flash and Flex are different, Flash is a powerful tool for
creating custom components and visual assets that you can use in Flex applications. You can
export files created in Flash in component package files called SWC files, which you can
reference as custom tags in MXML files. You can also use the MXML
<mx:Image> and
<mx:SWFLoader> tags to import SWF files into a Flex application.
Commenti su questo manuale