About the Flex coding process
Creating a useful Flex application is as easy as opening your favorite text editor, typing some XML
tags, saving the file, opening the file's URL in a web browser, and then repeating the process.
When you develop a Flex application, you use the same iterative process that you use for other
types of web application files, such as HTML, JSP, ASP, and CFML.
Unlike a set of static HTML pages or HTML templates created using JSP, ASP, or CFML, the
files in a Flex application are compiled into a single binary SWF file. Another major difference
between a Flex application and a JSP, ASP, or ColdFusion application is that application logic
resides in the client-side SWF file. JSP, ASP, and ColdFusion are templating systems in which
application processing occurs on the server and data is dynamically added to an HTML template
and delivered to the client in an HTML page. For more information, see
HTML" on page 58
Because MXML files are ordinary XML files, you have a wide choice of development
environments. You can develop in a simple text editor, a dedicated XML editor, or an integrated
development environment (IDE) that supports text editing. Flex also provides tools for code
debugging and performance profiling; for more information, see
on page
60.
Moving to Flex from HTML
Although similar in some ways, developing a Flex application is significantly different from
developing in HTML. HTML uses a page metaphor in which code is primarily written in a set of
page files. What constitutes an application is really a set of separate HTML pages. Each page must
be requested from the server and displayed individually. Assets such as images are loaded into the
individual page that uses them when the page is requested. During development, you write code,
save it, and display a page in a web browser.
The code for a Flex application is likely to be contained in more than one file to promote
reusability, extensibility, and modularity. However, when the top-level MXML file is requested,
the Flex server compiles that file and all the other files it depends on into a single SWF file. Once
the application SWF file is generated, the server does not recompile it unless the source code
changes. The files that make up the application are compiled into the SWF file; however, the
application can request data from external data sources at runtime. During development, you
write code, save it, and display the entire application in a web browser.
Although Flex development is quite different from HTML development, you can easily
incorporate a Flex application into an HTML page. To do so, you specify the name of a SWF file
with the same prefix as the MXML file but a suffix of mxml.swf in standard HTML
and
tags, as the following example shows:
<embed>
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=7,0,0,0' width='600' height='600'>
<param name='src' value='CreditCard.mxml.swf'>
<embed pluginspage='http://www.macromedia.com/go/getflashplayer'
width='600' height='600
src='CreditCard.mxml.swf' />
</object>
58
Chapter 4: Architecting Flex Applications
and
"Moving to Flex from an HTML templating environment" on page
"Moving to Flex from
"Using Flex development tools"
<object>
59.
Need help?
Do you have a question about the FLEX-GETTING STARTED WITH FLEX and is the answer not in the manual?
Questions and answers