Marking Deprecated Classes and Methods in Flex

ActionScript, Flex, IntelliJ IDEA 4 Comments »

A feature of the Flex SDK is that you can mark deprecated classes and methods via the [Deprecated] metadata tag. The goal of deprecating code is to inform developers that code will disappear in an upcoming release of a library or framework. Developers can then change their code to use the appropriate replacement and prevent problems when upgrading to newer versions. For more info, read How and When to Deprecate APIs.

The need for deprecation comes about because, as a class evolves, its API changes. Methods are renamed for consistency. New and better methods are added. Attributes change. But making such changes introduces a problem. You need to keep the old API around until people make the transition to the new one, but you don't want developers to continue programming to the old API.

Here's an example:

  1. package org.as3commons.reflect {
  3.   [Deprecated(replacement="org.as3commons.lang.ClassUtils", since="1.1")]
  4.   public class ClassUtils {
  6.     [Deprecated(replacement="org.as3commons.lang.ClassUtils.forInstance()", since="1.1")]
  7.     public static function forInstance(instance:*, applicationDomain:ApplicationDomain = null):Class {
  8.       // ... method body ommitted
  9.     }
  10.   }
  11. }

Depending on the IDE you are using, you will even get visual hints when you are using deprecated code. Here's how IntelliJ IDEA supports this. (Click to enlarge)


Note that I'm using an early build of the upcoming version 9 of IntelliJ IDEA, codenamed "Maia", in which Flex support has significantly been improved. You can get the prereleases here.

You can also use this on other metadata tags such as Style, but in a slightly different form:

  1. [Style(name="backgroundColor", type="uint", format="Color", inherit="no", deprecatedReplacement="swatchPanelStyleName", deprecatedSince="3.0")]

For more info on the [Deprecated] metadata tag, see the Flex documentation.

I haven't tested how deprecations are handled in Flex/Flash Builder and the ASDoc system. If anyone knows, don't hesitate to add extra info in the comments and I will update this post.

Update The [Deprecated] metadata tag was posted about some time ago in this blogpost, which made me believe it was undocumented or at least it was at the time of writing. Thanks to Bobby Parker for posting the link to the Flex 3 docs in which the metadata is clearly documented.

Add to Bloglines - Digg This! - - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner

Spring ActionScript 0.8 Released

ActionScript, Air, Flash, Flex, Spring ActionScript 15 Comments »

Dear Community,

I'm pleased to announce that the Spring ActionScript 0.8 release is now available.

Download | API Documentation | HTML Docs | PDF Docs | Changelog

This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions.

All libraries are available for download at the following Maven repository:

From now on, we will regularly publish new snapshots of the libraries there.

Direct links to the libraries:
- Spring ActionScript 0.8
- Spring ActionScript Cairngorm 0.8
- Spring ActionScript PureMVC 0.8

- AS3Commons Lang
- AS3Commons Logging
- AS3Commons Reflect

Note: AS3Commons Lang is a snapshot of 1.0. We will work with a release for the following releases of Spring ActionScript

Besides a series of bugfixes, optimizations and improvements, some of the major changes and enhancements include:

Autowiring support

Using autowiring allows you to inject objects managed by the container into view components and other objects. To autowire a property, annotate it with the [Autowired] metadata tag. The support we build in is pretty enhanced and allows you to customize the autowire behavior in many different ways. Within the Autowired metadata tag you can specify the object name and you can also configure the container to filter autowire candidates using your own filter specifications. Please see the documentation on autowiring for more info.

Custom Namespaces

The XML configuration now supports namespaces and allows you to create custom namespaces yourself. A few namespaces have been added to simplify the configuration of common objects for RMI and Messaging. More info on available namespaces and schemas and creating custom ones can be found in the documentation. The XSD schemas are available

MXML Configuration

We now also support configuration through MXML. The markup is very similar to the regular XML config, but with some slight differences. Please see the documentation on MXML Configuration


As a side project, we have started the AS3Commons project that offers reusable ActionScript 3.0 libraries. Most of the libraries currently available in AS3Commons are build using code from the Spring ActionScript framework. This means that a lot of code has been removed from Spring ActionScript and is now available for use in projects not using Spring ActionScript. Please note that you might have to update quite some import statements to refer to AS3Commons instead of Spring ActionScript. We apologize for any inconvenience this might cause, but this is only a one-time process.

We hope you find the AS3Commons libraries useful. All libraries (releases and snapshots) can also be found at the Maven repository.


The documentation has been tremendously improved in this version. Next to the API documentation, we now provide a reference guide in HTML and PDF format. General info can be found at the project website:

Last Words

If you feel like helping us out, we could certainly use your help. This project is entirely created on a volunteer basis and in our spare (and limited) free time so needless to say that the more people, the faster we can deliver new releases and guarantee the quality of the framework. So if you think you have someting to offer, be it as a developer, tester, documentation writer, sample creator, ... please contact me (christophe [DOT] herreman [AT] gmail [DOT] com) or leave something in the comments. All help is more than welcome.

Enjoy this release and have fun coding!

Add to Bloglines - Digg This! - - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner

Maven, Flex Mojos and Flash Builder 4 tip

Flash Builder, Maven, tips 'n tricks 3 Comments »

Here's a quick tip for those of you who are using Flash Builder 4's FlexUnit integration and also build with Maven and Flex Mojos.

When executing the unit tests of your library project or application, Flash Builder creates a FlexUnitApplication.mxml file in the root package of your main class path. This file is the test runner UI that gets compiled when the tests are run. The problem is that when you try to execute a Maven build on your project, the build will fail because the test runner UI will also get compiled.

A solution is to use the maven-clean-plugin in the build phase and configure it to delete the FlexUnitApplication.mxml file.

To use it, place the following xml in the "build/plugins" section of your Maven build file. You might need to change the "directory" setting to match your classpath.

  1. <plugin>
  2.     <artifactId>maven-clean-plugin</artifactId>
  3.     <configuration>
  4.         <filesets>
  5.             <fileset>
  6.                 <directory>src/main/actionscript</directory>
  7.                 <includes>
  8.                     <include>FlexUnitApplication.mxml</include>
  9.                 </includes>
  10.             </fileset>
  11.         </filesets>
  12.     </configuration>
  13. </plugin>

If you now execute a "mvn clean install" command, the file will be removed and the build should succeed.

Add to Bloglines - Digg This! - - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner

Flex Formatter Eclipse Plug-in

ActionScript, Air, eclipse, Flash Builder, Flex, Flex Builder, tips 'n tricks 11 Comments »

If you're using Eclipse and Flash/Flex Builder, you might want to have a look at the Flex Formatter Plug-in. It's a great add-on that allows you to (auto-)format your ActionScript and MXML files, based on the templates you define.

This is a key feature that is still missing in Flash/Flex Builder in my opinion.

More info:

Add to Bloglines - Digg This! - - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner

Spring ActionScript: site and documentation update

ActionScript, Air, Flash, Flex, Inversion of Control, Spring ActionScript 11 Comments »

Some quick news about the status of the project.

The Spring ActionScript project has a new home at!

We have been updating the documentation extensively and although this is still a work in progress, this should be a valuable resource to get started with the framework. Please see the "Documentation" section for more info and available doc formats.

There are also some neat new features like advanced autowiring and support for custom XML namespaces (available in SVN) that will be distributed with the new 0.8 release, expected to be released by the end of this week.

As usual, we appreciate any feedback. Join our Google developers group or the forum.

Have fun coding!

Add to Bloglines - Digg This! - - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in