[SVN] MXML bundle and the future of Flex on TM

Joshua Scott Emmons skia at skia.net
Tue Apr 24 03:13:48 UTC 2007

Greetings all. I've been working on an MXML bundle for the creation  
of Flex apps in Textmate. I know work is also going on to support  
Actionscript3, and I think that dovetails nicely with the bundle I've  
made (isn't that the magic of TM!?)

But with all these projects going on and Flex gaining popularity, it  
probably makes sense to have a Community Discussion™ about how we  
want to address Flex in TM down the road.

For those not up to speed on Flash/Flex/MXML/etc, here's the quick  
lay of the land:

Flash: a binary file format (.swf) read by a Flash Player (usually a  
web browser plugin). These files are most often used to present some  
sort of vector animation, but because of the scriptablility of Flash  
files and the Flash Player's ubiquity, there's also the possibility  
for using Flash as an application development platform.

Traditionally Flash binary files had to be created using the Flash  
authoring application sold by Macromedia (now Adobe). Textmate thus  
has little to do with the authoring of Flash files, per se. BUT...

Flex: is the name of a group of technologies that allow for the  
declarative construction of Flash files. Before Flex, you had to buy  
the Flash authoring application to construct Flash files.  
Unfortunately, the Flash authoring application was designed for  
animators, not programmers. Many developers found it bewildering and  
couldn't use it for application development.

To remedy this, Macromedia/Adobe created Flex. With Flex you can  
write source code that that describes what you want your Flash to  
look like, run it through the Flex compiler, and a Flash binary file  
comes out the other end. Flex lets programmers create Flash files in  
a way familiar to them: write source, compile, execute. Textmate has  
little to do with Flex itself, but it has everything to do with the  
"source" files used to create Flex applications. Namely:

o MXML -- an XML-based format used to define the structure and  
general appearance of the Flex app.
o Actionscript -- an ECMAScript variant used to define behavior and  
provide interactivity to the Flex app.
o CSS -- used to style the Flex app.

These three formats work together just like HTML, Javascript, and CSS  
do in a web page. MXML provide the structure and is the "main" part  
of the Flex application. MXML files can include inline Actionscript  
and CSS code, or can import whole Actionscript/CSS files just like  
HTML can inline or import Javascript/CSS.

It seems to make sense, then that we develop Flex support in Textmate  
just as we have developed web support -- there's an HTML bundle, a  
Javascript bundle, and a CSS bundle, and control is passed between  
them depending on the scope.

This is the tactic I've adopted in my MXML bundle. It's based on the  
XML bundle, adds a bunch of MXML-specific things, and passes control  
off to the Actionscript bundle whenever it comes across a <script></ 
script> block. As soon as the AS3 bundle is ready, it will punt to  
that, instead. And I'm about to add the code that hands off to the  
CSS bundle tonight or tomorrow. In my humble opinion, this works  
really well.

But what do the rest of you think?

-Joshua Emmons

P.S. For those using MXML bundle, know that version 0.5 is now out.  
I've added the ability to look up MXML tags in Adobe's online  
documentation. Also, the Help command that was accidently left out of  
the last version (doh!) is now back in there. Just in case you were  

You can get the latest at http://www.skia.net/media/mxml-0.5.zip

More information about the textmate-dev mailing list