Take the 2-minute tour ×

I am trying to develop an Android application and I heard that for someone with less-than-superior java skills, AIR/Flex might be a good place to start.

I am noticing that all I see in Flash Builder is MXML-based. Is this how all of the code in Flex written? Via XML?

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

It depends what you mean by "XML". MXML can contain chunks of ActionScript code both in blocks between <script> tags and right in line in attributes to controls tags, such as

<s:button click="someObject.DoSomething()">

This ActionScript embedded in MXML file is the pattern largely presented in the Flex in a Week series noted by @www-flextras-com.

But you can also have full, dedicated ActionScript files, both directly associated with .mxml objects and all by themselves. This "Code-Behind" design pattern is very much like the XAML design + C# code-behind combination in Windows Presentation Foundation applications.

An good introduction with a viewable example of strict code-behind in Flex :

share|improve this answer
add comment

Flex is a declarative, tag-based way of writing rich applications. Under the hood it is all ActionScript, though, so it is very easy to marry ActionScript code into a Flex application (as you often must do).

When I have coded with Flex, I use it as a declarative language. I use the tags to build out Views and data-driven containers. Then I write ActionScript classes to do all the imperative control logic. The relationship is similar to the one between JSP and Java, or (sort of) HTML and JavaScript.

In a nutshell though, yes, you can write whole Flex applications with its XML-like syntax and resort to ActionScript just to glue bits and pieces together, write small handler functions, etc.

This guy is a Flex genius and wrote a great book on it: http://dougmccune.com/blog/


share|improve this answer
add comment

Flex is a mix of MXML and ActionScript. MXML is indeed XML based; but ActionScript is an ECMA compliant language. Conceptually similar to JavaScript.

I suggest you start by reading through the Flex docs to give you some background. The Flex in a Week tutorials come strongly recommended.

share|improve this answer
add comment

Your Answer


