O'Reilly logo

Professional Adobe® Flex® 3 by Joe Berkovitz, David Hassoun, Andrew Trice, Tom Sugden, Todd Prekaski, Jun Heider, Peter Ent, Joseph Balderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. MXML Fundamentals

MXML is an XML-based, presentational markup language intended for laying out Flex components much like one would lay out HTML elements on a page. MXML markup may be combined with both CSS styles and ActionScript in the same file to create complete applications. This chapter explores the underlying principles of MXML, its syntax, and the ways in which it can be used with other languages in the Flex ecosystem.

The term "MXML" is not in fact an acronym, even though it is obviously derived from the term "XML". Although Adobe, and Macromedia before it, has never ascribed a definition to this term, the likeliest meaning for a possible acronym is "Macromedia eXtensible Markup Language," or the "M" is a remnant from the Macromedia "MX" line of products when Flex was first under development.

Language Principles

In this section, we'll explore the basic principles of the MXML language.

MXML Is XML

Since an MXML document is in XML, it must conform to the following guidelines:

  • It must start with an XML declaration, like so:

    <?xml version="1.0" encoding="utf-8"?>
  • It must be a well-formed XML document, which means that each element is closed properly, each element is nested properly, attributes are declared with single or double quotation marks, and comments adhere to XML standards.

  • The document must contain a root node. For the main application file for instance, this would be either <mx:Application /> for a Flex application or <mx:WindowedApplication /> for an AIR application. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required