User Guide
14 Chapter 1: Introducing Flex
Although you can consider a Flex application as part of the View in a distributed MVC
architecture, you can use Flex to implement the entire MVC architecture on the client. A Flex
application has its own view components that define the user interface, model components to
represent data, and controller components responsible for the communication with back-end
systems. This client-side separation of task is not available in HTML.
Typical application development steps
You typically develop a Flex application using the following steps:
1.
Within a text editor or integrated development environment (IDE), such as Macromedia Flex
Builder, Eclipse, or IntelliJ, insert the MXML root tags into an MXML file.
2.
Add one or more containers.
3.
Add controls to a container, such as input fields, buttons, and output fields.
4.
Define a data model.
5.
Add a web service, HTTP service, or request to a remote Java object.
6.
Add validation to input data.
7.
Add a script to extend a component.
Running Flex applications
Flex application files use the .mxml filename extension. You store these files under the web root
directory of your J2EE application.
A request to an MXML file has the following form:
http://hostname/path/filename.mxml
Upon receiving an HTTP request for an MXML file, Flex performs the following steps:
1.
Compiles the MXML file to produce a SWF file.
2.
Caches the compiled SWF file on the server.
3.
Returns the SWF file to the client.
The SWF file executes in Flash Player. While it is executing, the Flex application makes calls to
server-side services. For example, the application might issue a SOAP request to a web service, use
AMF to connect to a Java object, or make a request to an HTTP service.
Upon subsequent requests to the MXML file, the Flex server determines whether the MXML file
has been modified since the previous request. If not, it returns the same SWF file from the cache.
If the MXML file has been modified, the Flex server recompiles the file and returns an updated
SWF file to the client.