Home > Development > blogs
![]()
Let's continue our focus on the languages of Flex with a little discussion of MXML. We've learned that rich internet applications by their nature have more advanced functionality than say, a typical web page laid out with just HTML. We've also learned that the way a Flex application achieves this advanced functionality is by using ActionScript to provide the "logic" for its applications. Lucky for developers, there's a way to quickly employ the power of ActionScript to create applications that also have the look and feel of anything web based. Flex developers can use MXML.
MXML is a markup language, based on XML and created by Adobe to be used within the Flex platform. Those of you familiar with HTML know that markup languages can be used to control the visual layout of information. If you see markup such as "<p>", you know that what follows that tag is a paragraph. HTML has around a hundred or so specific tags that you use to control a page's visual layout; "<str>", "<body>", "<head>", etc. XML, on the other hand, contains no such specific tags. The "X" in XML stands for extensible, meaning that it's up to you to create your own tags to use in your document. XML is not a language, but rather a sort of "template" for which to create the elements of a language. MXML uses this XML template to provide certain built- in language elements for use within Flex. In this sense, MXML is a true language, the purpose of which is to carry the data of a Flex application.
So why exactly do we use MXML in our Flex applications? First, it helps to understand that all MXML tags refer to ActionScript code. Also, unlike HTML, MXML isn't limited to a set number of tags. Because it's extensible, you can create your own custom tags for use within an application. Just as you can create custom classes in ActionScript, you can use custom tags in MXML to reference those classes. Of course, just as easily, you can use MXML tags to reference built-in ActionScript classes. Consider the following MXML code that creates a Button control in a user interface:
<mx: Button/>
Pretty simple. What's interesting is that very small amount of code refers to some ActionScript code that is a bit more verbose. By simply using the MXML code above, we are telling the compiler to generate all of the ActionScript necessary for the creation of a Button object. The Adobe Developer Connection has a nice representation of what the difference between coding something in MXML, and coding the same thing in ActionScript looks like.
It should be noted that it's possible to code an entire application using just ActionScript, but, as you can see from the example at Adobe, it would take quite a bit more time and effort. MXML always refers to ActionScript code, so by utilizing the brevity of this markup language developers can more efficiently create rich internet applications.
Next, we'll be exploring the syntax of MXML. We'll see how it's similar to other markup languages, and we'll discuss further the roll it plays in Flex applications.
Next: LFFS - 9: MXML Continued... And A Sample Application For You To Work With!
- comments: 2
Comments
2 Comments
Leave a comment
Stay Connected
Search InsideRIA
Poll: ECMAScript Reaction
The ECMA organization recently decided to stop work on ECMAScript 4 and begin a new version, tentatively described as ES "Harmony." How would you like to see this affect the evolution of ActionScript?
News & Events
Latest Features
Tag Cloud
- .net
- 360Flex
- 3d
- actionscript
- adam flater
- adobe
- air
- air api
- air cookbook
- air resources
- air xml webkit
- ajax
- ajaxworld
- alertthingy
- amp
- analytics
- ant
- antipattern
- apache
- api
- app engine
- apple
- applications
- april fools day
- aptana
- architecture
- asp
- audio
- authors
- away3d
- aws
- backward-compatablity
- bad usability calendar
- benchmarking
- berlin
- beta
- bitmaps
- blazeds
- blendmode
- book
- browserplus
- bsd
- business
- businessweek
- cairngorm
- camp
- career
- cdn
- chart
- cloud
- code
- code generation
- coldfusion
- command design pattern
- communication
- community
- compiler
- component
- compression
- conference
- conferences
- contest
- creativecommons
- cs3
- cs4
- curl
- customer
- cuzillion
- dare
- data
- datatable
- datavisualization
- dbunit
- ddlutils
- debug
- decompiler
- deep zoom
- degrafa
- design
- design patterns
- desktop
- development
- DHH
- diary
- dionalmaer
- drawing api
- dreamweaver
- drupal
- dynpro
- ebay
- ecmascript
- effectiveui
- ejb 3.0
- elixir
- embedded jboss
- encryption
- enterprise
- europe
- event
- excerpt
- experience
- ext
- externalinterface
- eyetracking
- features
- filters
- firefox
- fireworks
- fitc
- flash
- flash10
- flashforward
- flashplayer
- flex
- flex4
- flexbuilder
- flexmdi
- flexunit
- form factor
- framework
- friendfeed
- gadget
- gears
- geolocation
- gesture
- googledocs
- googlegears
- gpl
- graphics
- graphics mask
- guidelines
- guimark
- hosting
- how-to
- html
- ia
- ie
- ie8
- igoogle
- interaction
- interface
- interview
- iphone
- iphonedevcamp
- iron man
- j2ee
- jakob
- java
- javafx
- javaone
- javascript
- javase
- javase6
- jaxer
- jms
- job
- joyent
- keynote
- languages
- lcds
- learning
- lffs
- lib
- library
- license
- licensing
- linux
- listen
- livecycle data services
- location
- madrid
- map
- marketing
- math
- maturity
- maven
- max
- memory
- merapi
- mesh
- metrics
- microsoft
- mikepotter
- mit
- mix08
- mobile
- mockup
- model locator design pattern
- mono
- mozilla
- mvc
- mxml
- mxmlc
- neilson
- netbeans
- nio
- nitro
- nitrolm
- nokia
- objectivec
- offline
- omnigraffle
- onairbustour
- onairtour
- onairtoureurope
- ontologies
- oop
- open source
- openflux
- openscreen
- opensource
- optimization
- orm
- papervision3d
- paris
- pattern
- pattern mining
- patterns
- performance
- photoshop
- php
- podcast
- popular
- portable
- preload
- pricing
- prism
- Processing
- Processing.js
- profiler
- protagonize
- push
- qt
- rails
- release
- research
- resources
- ria
- ria community
- ria roundup
- ribbit
- rich
- ruby
- rules
- sanctuary
- sap
- scalenine
- scheduling
- scott sheridan
- search
- security
- seo
- server
- service oriented architecture
- services
- session bean
- silverlight
- singularity
- social
- sockets
- software
- source
- spain
- sproutcore
- spry
- sqlite
- static code
- stencils
- steveounders
- stockholm
- streaming
- survey
- swc
- swf
- switchboard
- syscon
- test driven development
- testing
- testng
- thermo
- tip
- tool
- tools
- training
- trends
- trolltech
- tufte
- tutorial
- ui
- ui pattern library design
- uirc
- unconference
- unit testing
- usability
- user experience
- ux
- vector images
- video
- view source
- vision
- voip
- warsaw
- wdn08
- web
- web 2.0
- web 2.0 expo
- webkit
- whenisgood
- why
- widgets
- windows
- workshop
- wwdc
- xhtml
- xulrunner
- yahoo
- yui
Related Books
Development Series
Get an overview of the tools and technologies that work together to allow developers to build Rich Internet Applications (RIAs) quickly and easily.
Recent Comments
Archives
About This Site
Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.
About Us
Meet the Experts
Meet Our Contributors
Send Us Feedback

Good post, i'm enjoying this LFFS series :)
I recently made a study about MXML and how it compares to HTML.
For those of you that want to learn more about it you can check out here:
http://www.fabianvercuiel.com/layout-design-in-flex-for-html-developers-4.htm
@Fabianv
Thanks a lot for reading! I am enjoying your article on MXML, and have added your site to LFFS's del.icio.us links list. Cheers!