Using MXML and ActionScript

Version 1.3

Flex applications are developed using the MXML and ActionScript languages with the ActionScript class library, which contains components, manager classes, data service classes, and classes for all other features. Read more on the Adobe Web site.

MXML can be likened to HTML (tags that lay out the page), and ActionScript to JavaScript (the coding). In theory, you could write everything as ActionScript code (add a button here, put the map at the bottom of the page, etc.), but this is neither practical nor maintainable.

ActionScript 3 syntax is similar to other languages like C, C#, C++, and Java. ActionScript is an object-oriented procedural programming language and includes Java object-oriented features, such as extending classes and implementing interfaces.

There are several different ways to mix ActionScript and MXML:

Tip

Multiple steps take place behind the scenes when Flex compiles your application. The application is parsed by MXMLC, translated into an ActionScript file, and compiled into a SWF.

To better understand how Flex converts MXML tags into code, you can view the interim ActionScript files. These are deleted unless you specify the "--keep-generated-actionscript" option when compiling your application.