Category: News

03/03/06

Permalink 06:44:09 pm, Categories: News, 237 words   English (US)

Thinking Declaratively

This is a tip that will seem obvious to anyone who has done any Flex development, but it's something that took me a little while to figure out and I still need to remind myself of it every now and then.

In a procedural language like C#, Java, or JavaScript/ActionScript, when you want to do something, you need to figure out what class to use or what static method to call.

In MXML, there's a third place to look for functionality you need - tags.

You can declare class in your MXML by inserting and defining a tag that creates the object you're going to work with, and then use it in your procedural code. For example, if you need to print a Number formatted as a currency, you could add a CurrencyFormatter to your code:

<!-- Declare a CurrencyFormatter and define parameters.-->
   <mx:CurrencyFormatter id="Price" precision="2"
   rounding="none"
   decimalSeparatorTo="."
   thousandsSeparatorTo=","
   useThousandsSeparator="true"
   useNegativeSign="true"
   currencySymbol="$"
   alignSymbol="left"/>

This does the procedural equivalent of constructing an object named 'Price' whose class is CurrencyFormatter, with the parameters specified. You can then use this object in your ActionScript code simply by calling Price.format(myNumber) to get the value formatted as a string.

Coming from a procedural background, this can take a bit of getting used to.

03/01/06

Permalink 06:30:10 pm, Categories: News, 211 words   English (US)

Welcome to MXMLtips v2

Hello, and welcome to MXMLtips. There isn't much to see here yet, but I'm working on that.

I'm just a software developer, who is very impressed with MXML. I'm also very happy to hear that Adobe has decided to make parts of Flex available for free.

This is a good move, because declarative programming is on the rise, and Microsoft is coming on strong with their XAML technology. Microsoft's technology is, of course, only provided on Windows platforms.

MXML provides a way to create a rich UI using a declarative syntax, and run it today on millions of Windows, Macintosh, and Linux based computers. There is massive potential here, and the fact that portions of it will be available for free just helps ensure it's success.

So this site is where I'm going to talk about my own progress with MXML, useful things I discover, and I'll also publish notes that anyone else submits. If you've come up with something that helps make working with MXML or Flex easier, submit it here using the 'Submit News' link on the left (you'll only see it if you're logged in).

I started this site using Joomla, but after a bit of wrestling with it, I've switched to b2evolution.

Thanks for dropping by!

MXMLtips

I'm excited about MXML, and you should be too.

September 2010
Mon Tue Wed Thu Fri Sat Sun
<<  <   >  >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Search

Categories


Archives

Linkblog

b2evolution

Flex

Adobe

Syndicate this blog XML

What is RSS?

powered by
b2evolution