
About the Flex coding process
59
The first time the HTML page is requested, the Flex application is compiled into a SWF file with
the specified name. If the MXML file changes, the Flex compiler recompiles the MXML file the
next time that the HTML page is requested. For more information, see Chapter 38, “Using the
Flex JSP Tag Library,” in
Developing Flex Applications
.
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 on the
client in the SWF file that is generated when the user initially requests the MXML 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 Macromedia Flash MX
Developing a Flex application is very different from developing an application in Macromedia
Flash MX, 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. You publish Flex application source files to a Java
web application, and the files are compiled into a SWF file when a user requests the application-
level MXML file. If you change the application’s source code, it is recompiled into a SWF file the
next time it is requested.
You create a Flash document file (an FLA binary file) in the Flash MX visual authoring
environment, and save it as a SWF file before publishing it to a website; it is usually referenced
inside an HTML page. Flash MX 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 MX and Flex are different, Flash MX 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 MX 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:Loader>
tags to import SWF files into a Flex application.
Содержание FLEX-GETTING STARTED WITH FLEX
Страница 1: ...Getting Started with Flex...
Страница 4: ...4 Contents...
Страница 22: ...22 Chapter 1 Introducing Flex...