Monday, June 29, 2009

Pretty Good Impressions from Flash : Movie Clips

I've just recently started using Flash IDE as a development environment. Having a programming backgroung, I've always considered the Flash IDE too "out of the box" for development work. Plus, the built-in ActionScript editor, which I still do not like and try to avoid using always put out my efforts to deal with it. That's why my first experiments with ActionScript turned out to be using Flex. Flex is great, there is no doubt in that, but every tool has its particular purpose. When one wants to setup a WIMP web or desktop app, Flex is really the right one. For rapid prototyping and game development, though, it is not providing results fast enough. This is where Flash comes in.

I've always had difficulties figuring out what the movie clip was and how it worked. Well, most Flash books tend to explain it in the wrong way. Pretty much, a movie clip is the graphical representation of a class. In Flash, a movie clip is what a class is in programming - an abstract description. Just like in programming, a movie clip can be instantialized and changes to the class apply to all instances. Movie clips can be composed of instances of other movie clips, and every movie clip has its own timeline - every movie clip could have its own states and animations. I am coming to the greatest part for every developer - every movie clip can be linked to an ActionScript class. The only requirement for the class is to extend the MovieClip class. Isn't that great? As an experiment, I setup a simple project in which I created a gameCharacter class with simple logic that my game character should implement (methods like jump(), and accelerate()). Then I linked it to a Charater movie clip, and it worked like magic. Simply great.

No comments: