MXML: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 51: Line 51:


== Links ==
== Links ==
; At Adobe


* [http://www.adobe.com/devnet/flex/ Flex Developer Center] has a lot of information. Not always obvious to find the best entry point for beginners, but have a look at these (if the links didn't move ...):
* [http://www.adobe.com/devnet/flex/ Flex Developer Center] has a lot of information. Not always obvious to find the best entry point for beginners, but have a look at these (if the links didn't move ...):
Line 59: Line 61:
* [http://flex.org flex.org] (an Adobe blog) aggregates Flex news from a number of sites. It includes MXML-related stuff.
* [http://flex.org flex.org] (an Adobe blog) aggregates Flex news from a number of sites. It includes MXML-related stuff.


; MXML Schemas
Adobe doesn't seem to provide any sort of schema that would allow you to use an XML editor. But there are some initiatives.
* Flex 1.5/2 (old) [http://falkensweb.com/mxml2.xsd mxml2.xsd] from Falkensweb. I made a [http://tecfa.unige.ch/guides/flash/doc/mxml2.xsd local copy]
* [http://code.google.com/p/xsd4mxml/downloads/list flex3.xsd] made by Ali Mansuroglu. I made a [http://tecfa.unige.ch/guides/flash/doc/flex3.xsd local copy]
* Matthias Georgi in order to support [http://www.matthias-georgi.de/2008/9/relax-ng-schema-for-adobe-flex-3.html development on Emacs] created a Relax NG Schema for Adobe Flex 3 ([http://www.matthias-georgi.de/download/flex3.rnc flex3.rnc download]) and that is based on Ali's XSD.
; Others
* [http://en.wikipedia.org/wiki/MXML MXML] (Wikipedia. Still a stub, i.e. not very useful as of Aug. 2008)
* [http://en.wikipedia.org/wiki/MXML MXML] (Wikipedia. Still a stub, i.e. not very useful as of Aug. 2008)



Revision as of 20:19, 5 November 2008

<pageby nominor="false" comments="false"/>

Definition

MXML is an XML-based user interface markup language. MXML is considered a proprietary standard due to its tight integration with Adobe technologies, in particular Flash.

The Adobe Flex developer kit can be use to compile MXML + ActionScript code into Flash. It's a fairly popular technology for developping rich internet applications (e.g. educational multimedia).

This entry is part of the ActionScript and Flash series of articles.

MXML allows to define

  • layout structure
  • some behaviors
  • presentation of information

Introductory example

Firstly, install the Flex SDK.

A Flex program is a text file that contains a combination of xml elements and optionally actionscript instructions. Here, we just focus on the MXML part.

A basic mxml document would look something like this:

File myFirstApplication.mxml :

<?xml version="1.0" encoding="utf-8"?>

<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    horizontalAlign="center" verticalAlign="middle" 
    width="300" height="160" >
    <mx:Panel 
        paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"
        title="My First Application" >
        <mx:Label text="Hello World!" fontWeight="bold" fontSize="24"/>
    </mx:Panel>
</mx:Application>

Make sure to respect XML Syntax (e.g. closing tags).

Put the text above in a text file. Save the text file as "myFirstApplication.mxml". See the "editing software" section in the Flex article if you plan to use an editor with Flex support. But for starters you can use any text editor, preferable an editor with XML support.

Assuming the Flex SDK is properly installed, in the terminal, type:

mxmlc myFirstApplication.mxml

Information appears on the screen and about half a second later, if all is well, you get informed that a file "myFirstApplication.swf" has been produced. Open this file in a flash player or in a web browser.

SWF files generated by Flex require Flash Player 9 or above.

Links

At Adobe
  • flex.org (an Adobe blog) aggregates Flex news from a number of sites. It includes MXML-related stuff.
MXML Schemas

Adobe doesn't seem to provide any sort of schema that would allow you to use an XML editor. But there are some initiatives.

Others
  • MXML (Wikipedia. Still a stub, i.e. not very useful as of Aug. 2008)