PASZ.COM LABS

Friday, April 21, 2006

Another Look At FlashDevelop

I'm starting a new project this week, and I thought it would be a good time to give FlashDevelop another look. Wow! What a difference a month makes. This application has really come together. Pretty much all the configuration issues I had when I tried it in March have addressed. This thing just works!

Anyone researching options for OS Flash development should seriously give FlashDevelop a look. It puts MTASC, FlashOut a lot of other cool features right at your fingertips. Especially since ASDT development seems to be in a holding pattern.

Tuesday, April 18, 2006

Flash Dev Gotchas #8 - Using loadMovie() with attachMovie()

This one's an oldie, but a goodie, so it made my list at #8.

I think it bears mentioning because it's rather bewildering that, considering all the other functionality that's been added to the Flash Player over the years, nobody has fixed this. Colin Moock was the first to sum up the problem clearly in his classic ActionScript for Flash MX: The Definitive Guide:
Loading an external .swf file into a clip instance with loadMovie() has a surprising result--it prevents us from attaching instances to that clip via attachMovie(). Once a clip has an external .swf file loaded into it, that clip can no longer bear attached movies from the Library from which it originiated. For example, if movie1.swf contains an instance named clipA, and we load movie2.swf into clipA, we can no longer attach instances to clipA from movie1.swf's Library.

You'd think that by now I wouldn't fall into this trap anymore, but it still plagues me once in a while.

In my last project, my initial prototype had all the assets in the library of a single clip. It's easier to develop prototypes this way because you don't have to worry about loading external files. So I was using attachMovie() all over the place.

As the project grew, it made sense to migrate the assets to external files. Unfortunately, changing my functionality from loadMovie() to attachMovie() was big a headache. Especially because in some cases I was calling attachMovie() on other attached movies (nesting the attached movies). This functionality had to be reworked significantly once we were using external files.

I had always known that we'd eventually use loadMovie() for all the assets. I had built the prototype with attachMove() mainly because I was being lazy. In the long run, it would have saved me time to build the whole system the right way the first time.

This experience points to a more software development general guideline: Don't defer the dirty work.