Principles of MXML
MXML and ActionScript are used hand-in-hand to create Rich Internet Applications.
MXML is used with Flex Server and is dynamically compiled into standard binary
SWF files. However, Adobe’s Flex Builder IDE and Flex SDK can also generate SWF
files from MXML for you to use without having the Flex Server.
If you know HTML, then MXML should be fairly easy to understand, since they’re
so similar. MXML is an XML-based markup language; it has a more structured and less
ambiguous syntax than HTML and includes more tags than HTML. For example,
DataGrid, Tree, TabNavigator, Accordion, and Menu are all some of the standard sets
of tags. You can also extend MXML tags and create your own components. But the
most significant difference is that the Flash Player, which enables your users to have
an interactive experience with your web site as opposed to a static HTML-based page,
renders MXML-defined user interfaces. You can also hand-code MXML using an IDE,
such as Eclipse or Intellij.
XML
XML stands for Extensible Markup Language: a general-purpose markup language, just like
HTML, but more restrictive. Standard Generalized Markup Language, or SGML, was the
precursor to XML; hence, XML is a simpler way to code but is a subset of SGML. There
are two levels of correctness for an XML document:
●Well-formed If your document is formed correctly, it conforms to XML’s syntax
rules. For example, if an element has an opening tag with no closing tag and isn’t
self-closing, it’s not well-formed. This then means that a conforming parser isn’t
allowed to process the document.
●Valid A valid document also conforms to some semantic rules. These are either
user-defined or included as an XML schema or DTD. As in the well-formed definition,
if a document contains an undefined tag, then it’s not valid and a validating parser
can’t process it.
Since HTML and XML have proved that they are easy to use and can create user
applications, MXML piggybacked on this success and is really just a derivation of XML.
Principles of ActionScript
Just as MXML is derived from XML, ActionScript is a scripting language based on a
derivation of JavaScript. So, if you already know XML and some JavaScript, half the
battle is already won; you’ll ramp up fast with Flex’s languages. ActionScript was initially
designed for controlling simple 2-D vector animations created in Flash. But ActionScript
was given more functionality as Flash grew, and more current versions allow for the
creation of web-based games and Internet applications with the accompaniment of audio
and video. As you’ll see in the ActionScript timeline, it’s gone through some serious
re-working to make it a robust language.
There were limited interactivity features in the first three versions of Flash, which
meant that ActionScript was limited to attaching a single command to a frame or button.
Then there were also constraints on basic navigation, which only allowed for simplistic
controls, for example:
●Play
●Stop
●Get URL
●Goto