« May 2007 | Main | July 2007 »

June 28, 2007

MAX Talk: Continuous Integration with Flex, FlexUnit, and Ant

I'm going to be speaking at the upcoming MAX about Continuous Integration with Flex, FlexUnit, and Ant. The talk description is:

Learn about tools and techniques needed to get continuous builds, integration, and testing running with a Flex project. I'll cover the fundamentals of build and test automation, the popular open-source Ant build tool, setting up and running FlexUnit tests from the command line, and integrating the entire process into an automated build system. I'll also demonstrate Antennae, a publicly available set of templates for building even very complex Flex applications using Ant.

If there are particular topics that you'd like to see covered let me know.

June 22, 2007

RangeError: Error #2006: The supplied index is out of bounds.

A problem I've run across a couple of times when moving a component from one parent to another is the following error:

RangeError: Error #2006: The supplied index is out of bounds.
	at flash.display::DisplayObjectContainer/getChildAt()
	at mx.core::Container/getChildAt()
	at mx.containers.utilityClasses::CanvasLayout/measure()
	at mx.containers::Canvas/mx.containers:Canvas::measure()
	(... some of stack trace deleted ...)
	at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()
	at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()
	at [renderEvent]
	at [mouseEvent]

You'll notice that the stack trace is nothing but framework code. An error in a callLater that I didn't make? The problem is simple. When moving a component from one parent to another you have to call removeChild() on the current parent before calling addChild() to attach it to the new parent.

The following code demonstrates the issue:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
private var goToBob:Boolean = true;
private function swap():void
    if (goToBob)
        // uncomment both removeChild() calls to prevent the error
        // alice.removeChild(aButton);
        // uncomment both removeChild() calls to prevent the error
        // bob.removeChild(aButton);
    goToBob = !goToBob;
<mx:Label text="Clicking the Swap button twice will cause a RangeError: Error #2006"/>
<mx:Canvas id="alice">
<mx:Button id="aButton" label="Swap" click="swap();"/>
<mx:Canvas id="bob">

As noted in the code comments, if you first call removeChild() the error goes away. While it would be nice if the framework let to just move a component in a single step, I seem to remember seeing in the documentation that the need to call remove before add is explained.

June 21, 2007

Antennae: Ant Templates for Flex

I'm pleased to announce the release of Antennae version 1.0000. This is the first release since Antennae was migrated from Joe Berkovitz's blog up to Google Code. You can access the project at http://code.google.com/p/antennae/. This release includes a bunch of tweaks and new functionality. For those that are not familiar with Antennae it covers:

  • Macro tasks for invoking mxmlc and compc
  • Ready made templates for application projects and library projects
  • A robust system for importing and exporting assets from one project to another
  • A solid way to compose projects inside container projects
  • Dependency checking on sources and libraries to avoid unneeded recompilation
  • Handling for HTML page token substitution and web app deployment
  • Automated unit test suite generation and command line integration with Flexunit

This release is primarily aimed at getting the tools out there for public consumption. Future releases will focus on additional documentation and other ways Ant can help automate your Flex builds. Please let us know what other improvements you would like to see.

Tags: ant antennae flex

June 13, 2007


I've been very impressed with USA's lead up to the start of this season of 4400 (Jun 17th). I've been getting a steady stream of SMS messages since signing up for them at the end of last year. They have also launched an aggressive online video, blog, website campaign (which at times has been more interesting to follow then the real news). The focus is around these sites:

Then there are the YouTube videos (which are linked from the above sites).

Tags: 4400

Flashforward Boston Ant Talk

I'm going to be speaking at the upcoming Flashforward Boston about Automated Flex Building and Unit Testing. The description hasn't made it up onto the site yet but is roughly something like:

A talk focusing on tools and techniques needed to get continuous integration running with a Flex project -- that is, ensuring that at any given point in time, your application is buildable and free of errors. I'll cover how to automate the build process with Ant, setting up and running unit tests both interactively from the command line, and integrating the entire process into an automated build system. All tools used are open-source and publicly available.

If there are particular topics that you'd like to see covered let me know.

Tags: ant flex

June 11, 2007

Inversion of Control in Flex

At the recent BFPUG Design Patterns Meeting I gave an overview of Inversion of Control. Unfortunately due to time constraints I wasn't able to also put together a compelling example and as such I won't be posting the lame example I did put together. Instead I'll point you to an example that demonstrates the concepts and gives you something more to play with.

The ReviewTube source contains an example of IoC. The main file to look at is "com/joeberkovitz/reviewtube/services/ReviewTubeComponents.mxml" which is pulled in from "ReviewTube.mxml".

The key concept is that by using MXML style bindings, you declare a component once and give it a name through the id property. Now everywhere else that you need to reference that component, standard MXML binding syntax can reference that component. The use of setter dependency injection makes it all work. A couple of points not captured in the slides that should be pointed out.

  1. Make sure the MXML file that defines your components is the first child of your main application. That way the creation of everything gets kicked off as soon as possible.
  2. You will probably want to put a creationComplete handler on the MXML file to indicate that component configuration is done and your main application can start.
  3. Components should not rely on the order that their dependent components are set.

Tags: design flex ioc

June 4, 2007


I just got back from visiting Erin in Aberdeen Scotland. It was a blast. I've not had time to collect my thoughts and do a proper summary but I have done a first pass at putting up pictures.

Tags: life scotland

Marriage in America

The May 26, 2007 edition of "The Economist" had an article about Marriage in America. It is a great read if you care to see the rest of it. A couple of statistics that caught my eye:

  • 29% of college-educated women got divorced within 10 years when married between 1975-1979, but only 16.5% when married between 1990-1994.
  • 38% of high-school dropouts got divorced within 10 years when married between 1975-1979, but 46% when married between 1990-1994.
  • 92% of children whose families make $75,000 or more live with both parents, while only 20% of children whose families make less than $15,000 do.
  • Two-thirds of children born to co-habiting parents who later marry will see their parents split-up by the time they are ten.

Combine this with a negative savings rate, possible housing bubble, and things start to not look too good.

Tags: marriage


It has been some time since I've finished a book. I attribute it to my phase nature. In any case I recently read "Thunderstuck" by Erik Larson. I really enjoyed the last book of his that I read. Overall I liked "The Devil in the White City" better. "Thunderstruck" is an enjoyable read and it does a great job of capturing the race for wireless communication set against the scientific bickering of London and intertwines the mysterious murder committed by Dr. Crippen. What it didn't do is draw me into both stories.

It might be my scientific nature but the Marconi story line had a richer feel to it and I felt fully engrossed in the drive to communicate without wires. The story of Crippen, while told well, didn't have the depth that the killer did in White City. The additional background on Crippen helped flesh out the character but it felt more like back filling the story from the incredible chase across the Atlantic which tied the two stories together.

The descriptions of London around the 1900s are neat, but feel more like digressions then central to the story. Likewise the author even asks "to forgive my passion for digression." [ix]. I believe that such comments can add flavor and context to the main story, but in this case the digressions feel like they are the story and the main characters the digression. Overall it is a fun and quick read, but for reasons very different then the last book of his I read.

Tags: books london science