What happened to the MovieClip?

Flash development is fun…at least, it’s supposed to be. Think about it – why is Flash “Flash?” How did it become “Flash?” It’s because legions of digital artists loved making their designs come to life, loved what a simple little plugin could do within the browser. Before the JavaScript revolution, before HTML5 and the anti-plugin revolution, it was about artists making sht move. “Flash” was born during the time of Real Player, and Netscape, and IE 4. Go back to tweened insanity in Flash 4 and you’ll see innovation, Flash developers duplicating MoveClips and enter-framing their way into animated oblivion. Follow things a few more years and you’ll see the 2 frame Flash movie becoming the standard. Then Flex, the component framework, the development paradigm that would take Flash into the enterprise. But what happened to the MovieClip?

During the day I am responsible for the evolution of an in-house Flex application framework focused on the integration of Flex applications across domain boundaries. As have most Flex developers, I found myself, and my framework, in the middle of a Flex 4 migration. Fortunately I have some talented developers on my team, so migration to Flex 4 was pretty much, a non-issue.

But lately I have been rethinking a few things “Flex.” And truthfully, this reevaluation started at 360|Flex in San Jose, where I first encountered Reflex, a component framework that remembered the the MovieClip, more specifically, the Sprite, but the point is, the lower level goodness of the Flash platform. There has been a lot of discussion around the restructuring of Reflex, specifically Ben’s fork of the codebase and Tyler’s reestablishment of Stealth. In my opinion, it’s a good thing. My hope is that these projects will allow their respective founders to scratch their own itches – work out some details, and then be merged back into a single, and stronger project. But I digress.

What I’m rethinking is the Flex framework itself. Flex 4 is better than Flex 3: I get that. And I’m glad to see Adobe attempting to right some of the wrongs of their component framework. But reading through the code of Minimal Comp’s makes me remember what it felt like to be a Flash developer. Minimal Comps design is refreshingly simple compared to Flex. For example, its invalidation mechanism is about as simple as you can get.

// com.bit101.components.Component
public class Component extends Sprite{
  ...
  // Marks the component to be redrawn on the next frame.
   protected function invalidate():void{
     addEventListener(Event.ENTER_FRAME, onInvalidate);
   }
   
   // Called one frame after invalidate is called.
    protected function onInvalidate(event:Event):void{
      removeEventListener(Event.ENTER_FRAME, onInvalidate);
      draw();
}

   // Abstract draw function.
   public function draw():void{
     dispatchEvent(new Event(Component.DRAW));
   }
...
}

And that’s as simple a validation mechanism as you can get! Beautiful. Of course, Minimal Comps is also less flexible but I’m cool with that.

“Who wants to build a custom component out of Sprites for every project?” Well, I think I do actually.

Leave a comment