Category Archives: ActionScript 3

Getting a Reference to the DisplayList in FlexUnit 4.1 Unit Tests

Although it’s generally frowned upon, sometimes the code under test needs to gain a reference to the Stage and or DisplayList.  In my case I was unit testing a component which listened for children being added and removed from the DisplayList. The … Continue reading

Posted in ActionScript 3 | Leave a comment

Converting XML into Objects – Data Marshalling in ActionScript 3

Data Marshalling is a common task that nearly every ActionScript 3 developer will face at some point; put simply it is the process of converting an Object into a data interchange format (for example XML, JSON or AMF) and likewise … Continue reading

Posted in ActionScript 3 | Tagged , , | Leave a comment

Eventual Assertions in FlexUnit 4

After a conversation with a work colleague about EventuallyMatchers in Specs (a BDD Testing Framework for Scala). The basic idea behind Eventually Matchers is that you have a condition you with to assert against which won’t be met until some … Continue reading

Posted in ActionScript 3 | Tagged | 1 Comment

Delcare Your FLEX_HOME Environment Variable in Windows

When you compile your Flash applications using ANT, you’ll often come across the fun problem of having to point to a Flex SDK to get access to the MXMLC, COMPC and ASDOC jars. One approach is to simply hard-code the … Continue reading

Posted in ActionScript 3, Windows | Leave a comment

Maven and ANT – Managing Your Flash Project’s Build Dependencies

Project build dependency management and resolution is one of the more difficult problems you’ll face as your project grows in size; however even the smallest of projects (and teams) can benefit greatly from getting automatic dependency resolution in place. So … Continue reading

Posted in ActionScript 3 | Tagged , , | 3 Comments

FlexUnit 4 assertAfter Async Helper

Update: Ah, there we go, there was a native method in FlexUnit for this! You can instead make use of Async.delayCall(). One of the things I aim for when writing unit tests is to make the test cases as easy … Continue reading

Posted in ActionScript 3 | Tagged , , | Leave a comment

Revisiting the Builder Pattern in ActionScript for Immutable Models

A while back I made a post on using the Builder Pattern to create Fluent Constructors – the principle being that instead of having a Model object with a bajillion (in practice, more than 3) arguments, you make use of … Continue reading

Posted in ActionScript 3 | Tagged , , , | 1 Comment

FDT Template – Builder Pattern Helper

This FDT template is pretty much invaluable when it comes writing a Class that follows the Builder Pattern (for example, a Builder for a Fluent Constructor). public function ${value}(value : ${type}) : ${enclosing_type} { _${value} = value; return this; } … Continue reading

Posted in ActionScript 3 | Leave a comment

ANT: This compilation unit did not have a factoryClass

A coworker of mine just asked me how to deal with this MXMLC error which was being thrown during her ANT script when using the FLEX 4 SDK. This compilation unit did not have a factoryClass specified in Frame metadata … Continue reading

Posted in ActionScript 3 | Leave a comment