Monthly Archives: April 2008

Modern Flex Developer – A Video for 30onair

Not long ago, Adobe’s Ted Patrick introduced 30onair, a community video project promoting Adobe technologies. What a great idea, I thought, but I didn’t have any good ideas right away. Thankfully, Phillip Kerman made enough WHY videos to keep us entertained for years.

Finally, I decided to show my love of Flex with a little song. Without further ado, here’s Modern Flex Developer, a parody of Gilbert and Sullivan’s Major General’s Song.

You don’t seem to have Adobe Flash Player 9 installed. It is required to view this content!

Enjoy!

Learning ActionScript 3.0 offers the best intro to Flash development

Very few Flash or Flex development books get me excited. They’re all generally pretty decent, but only the rare ones1 make me want to read cover to cover. A good programming book is one that I want to share with others before I’m finished reading it. Among those great gems, I’ve recently added Learning ActionScript 3.0 by Rich Shupe and Zevan Rosser. It certainly lives up to its title.

Learning ActionScript 3.0 differs greatly when compared to other books published by O’Reilly. The most obvious difference when you see this one on the shelf will be that there’s no iconic animal drawing on the front cover. When you pick it up, and start looking through its pages, you’ll soon discover an even more surprising difference. Every page in Learning ActionScript 3.0 is printed in full color. All the code is formatted to match Flash CS3’s ActionScript editor. All the screenshots are, you guessed it, fully colorized. Unlike many other developers, we of the Flash community tend to work on projects that are highly visual. Screenshots in previous Flash and Flex books I’ve read have been greyscale and sometimes very difficult to see. Learning ActionScript 3.0 sets a new standard. The books I read in the future will lose points immediately for crappy black and white screenshots.

The visual treatment isn’t all that stands out. The authors have experience teaching “thousands of students at universities, training facilities, and conferences”. In the preface, they explain that they’ve been told time and again that no ActionScript book for beginners is truly all that good for the intended audience. They set out to try to fix that problem. In my opinion, they’ve done an excellent job crafting a book that slowly eases someone into programming ActionScript without being too overwhelming. They wait six chapters before introducing Object-Oriented Programming, and I think it works very well. The first three chapters offer the bare minimum of programming concepts and then the reader is taken into sections about how to use the Display List and the Timeline. Only then, after the reader has built a couple things, and hopefully gained some confidence, do the authors begin to introduce the complete concepts behind objects and classes. It’s a very gentle introduction with enough hands-on learning that it doesn’t get boring.

In later chapters, the authors touch a bit on text, sound, video, animation, drawing, and loading external assets like images and XML. With each topic separated into its own chapter, I get the feeling that this book will be an excellent resource for someone who might want to skip certain bits of functionality and reference it later as needed, or for a beginner that needs a refresher every once in a while. I noticed on several occasions, as I was reading, that these sections cover many of the most common questions I see in online Flash forums.

The book ends with a chapter on “Programming Design and Resources”. This chapter introduces various software development models, such as waterfall, spiral, and several agile methods. I like that this section was included because most Flash books don’t really mention larger project-scale processes that developers might want to consider following. It’s refreshing and forward thinking. After that, the reader gets a very short introduction to design patterns. Though I was impressed that they were included, I felt this section could have been bigger or omitted. With such a slow introduction to OOP earlier in the book, the sudden appearance of what many consider a very advanced topic felt out of place. Still, I think it will probably help inspire some especially-talented new developers to discover how to move to the next level, so perhaps it fits. Finally, the chapter ends with several large lists of online resources for Flash developers, including many popular blogs (sadly, not mine. haha), open source libraries, books, forums, conferences, and more. For someone new to Flash development, this section alone offers hundreds of ways to go beyond what’s in the book.

While targeted more at beginners, Learning ActionScript 3.0 serves as an excellent reference to some of the most common tasks ActionScript developers encounter daily. The transition from the very basics of Flash programming to more advanced topics is gentle, but engaging. The full color pages throughout this book separate it from everything else on the shelf, and O’Reilly couldn’t have chosen a better topic than Flash to enhance with this wonderful addition. I’m not the only person excited about this book either; Lee Brimelow, Platform Evangelist at Adobe, called it “the best ActionScript book ever written.”

1For reference, the last Flash book that got me excited was Object-Oriented ActionScript for Flash 8, which I read back in 2006 (there’s an updated version, Object Oriented ActionScript 3, if you’re interested).

Bugs and Feature Requests for JSFL

JSFL makes me bang my head on the desk sometimes. Don’t get me wrong, JSFL is useful. I’ve been using it for some time now to partially automate builds for Flash CS3 FLAbased components. I can create component shims, live preview SWFs, and many things of that nature which normally take a long time to do manually. Unfortunately, I can’t get everything working perfectly for a fully automated build. Here are a few problems with JSFL that have been making me extra angry:

  • library.updateItem("itemName") Crashes Flash CS3

    This works like the Update… option that’s available when you right-click on something in the library. Basically, it lets you update your symbols from a source FLA. This is useful for component examples that need an updated component symbol from the main FLA. Apparently, updateItem() worked well in Flash 8, but calling it brings the whole application down in Flash CS3. A topic about the crash on the official Flash forums includes a response from someone at Adobe that says that this bug has been fixed and will be included in the “next release”. Will this be an update to Flash CS3, or are we talking CS4?

  • Copy an Item from one FLA’s library into another FLA requires confirmation

    As a workaround to the updateItem() bug, one can add a symbol from the source FLA’s library to the stage of the destination FLA. This will replace the out-of-date symbol in the destination library, but it displays a confirmation dialog that you have to interact with manually.

    Flash CS3 LIbrary Conflict Dialog

    Several other JSFL functions have flags to let you bypass dialogs like this (such as the bPromptToSave parameter used by fl.closeAll()), but document.addItem() does not.

  • Component Live Previews cannot be set or updated with JSFL

    FLA-based components need a live preview SWF embedded in the FLA to have the component appear properly on stage when the user drags it there. As I mentioned, I can easily create that SWF with JSFL, but making my component use (or later update) that SWF is another story.

    To manually update the live preview SWF, you have to right click on the component, go into Component Definition…, click the Set.. button in the live preview section, click the Update button, click OK in one window, and then click OK in the next. There is no API to set or update it with JSFL, and all that clicking leads to long builds.

Hopefully, some of these things can be cleared up in Flash CS4 (or maybe a CS3 hotfix for that crash bug, please?). In theory, it will be possible to modify and create files using the upcoming XML/ZIP FLA file format called XFL completely outside the Flash authoring environment. It doesn’t help me now, but I rest just a little bit easier knowing that I’ll have an easy job creating builds in the future when XFL becomes available and I may no longer need most of my JSFL scripts. Adobe, want to make things just a tiny bit easier? I’d love for Flash CS4 to include a native command-line compiler to build FLA files. I already run Flash from the command line now, but I’d rather not have the whole IDE open when I don’t need any visual tools.