Filed under Flash

The state of the Flash IDE and the FlashBuilder name change via Blogging

by

I just finished reading a great post by Kevin Suttle which is not short, but a must-read nonetheless. Go ahead and read it, I’ll wait.

You didn’t read it, did you. Well, it’s basically a very well-formed rant lamenting the sad state of the Flash program (not the platform). There are so many things that needed to be said here. I have been aware of the sorry state of the Flash IDE ever since CS3 came out but never took the time to construct such a compelling article as Kevin has.

ActionScript has matured from a simple frame-based script to a full-fledged language but the Flash IDE remains a glorified animation program (I am reluctant to even call it an ‘IDE’). Most of us who are serious developers are happy to switch to more powerful programming environment such as FlexBuilder, however there are thousands of users who learned programming on Flash who shouldn’t have to switch just because Adobe decided that we’re all either designers or developers. There should be a sense of responsibility to the huge workforce of artisans and engineers who rely on this product to make a living.

On that note, I am very pleased that they decided to change the name from FlexBuilder to FlashBuilder. I can’t tell you how often I’ve been in a scenario like this…

Flash Guy: “Import statements are a pain in the ass.”

Me: “I know. But using FlexBuilder makes it a lot easier because the imports are automated.”

Flash Guy: “But I’m not working on a Flex project.”

Me: *Hand to forehead*

The name FlashBuilder helps to support the idea of the Flash Platform which encompasses many technologies. Danny Patterson has makes some good points on the subject on his blog as well. Most interestingly, the suggestion to change the name of Flash Professional CS4 to Flash Designer CS4.

I think Adobe opened the flood gates to these types of discussions wheen they decided to treat designers and developers as separate camps but I’m glad they’re rethinking their approach.

Iron Flash Competition LA 2009

by

ironchef

Last night, I participated in the Iron Flash competition at the LA Flash Users Group in Venice Beach. As in Iron Chef (my favourite television show), the participants are all skilled Flash users pitted against one another with the goal of creating something interesting within a strict time limit and featuring a common “ingredient”. In this case, the ingredient was a set of pictures of ‘pucks’, specifically, R. Blank’s dog Puck, Puck the faun, Puck from the Real World, and a hockey Puck. We had 3 hours to make something out of any or all of the pictures. My fellow competitors were Jon Ruppel of Hooky Interactive and Ben McMaster (also at Hooky) who both made some awesome stuff in such a short time. UPDATE: All of the entries have been posted on the LAFlash site.

It was a great experience, and not just because OMG I WON!!!

My entry was a video game featuring Puck the dog. I was considering other physics based games involving the hockey puck and the dog somehow. Then I thought of using the dog instead of the hockey puck and somehow that reminded me of the sport beloved in Canada, Curling! The scoring system is a little wonky but if I may say so, it’s not bad for 3 hours work. Here are screenshots (click to link to the game) along with the source code:

Download the source code

puckcurling-title

puckcurling-gameplay

Tagged , , ,

Fast Intro to Flash

by

There is plenty of documentation, tutorials and explanation of Flash on the internet, blogs and books. However, it’s hard for me to find a good, concise article that covers Flash well. I’ve been exposing Flash 9 to a friend of mine recently and I’ve decided that a concise explanation is something I should write. This post will be brief, high level and will cover Flash as a platform and not the Flash IDE. This article is also intended for those with previous exposure to technical concepts such as virtual machines and compilers.
Continue reading

Using Abstract Classes in the Flash CS3/4 Library

by

Here’s a little trick that can help you save lots of time that might otherwise be spent creating multiple specialized classes in your Flash project. This trick makes use of the Base Class field in a symbol’s actionscript properties. (For info on creating pseudo-abstract classes in AS3, go here)

By the way, this tip may be common knowledge to Flash users. I use FlexBuilder almost exclusively these days but recently have had to dip back into the twisted world of the Flash IDE so please refrain from leaving any comments about how I shouldn’t use the timeline.

The Problem

Say you have several different buttons for a site that each look of behave slightly differently but all share the same underlying functionality. In this example, I’ll be using a crude set of video controls. I want each of these different controls to respond to rollovers by showing the label beneath the icon.

picture-1

Each  control has different icons and text so they’re going to need to be kept in different symbols. One solution might be to try to cram all the icons into one master symbol and change between the different icon frames using code. But that’s sloppy and unnecessary. Another solution might be to create 4 different classes that each implement the functionality or each extend a class with common functionality. This is a much better solution, but requires you to create 4 AS files for what functionally is just 1 type. You cannot use the same class for multiple symbols in your library though. Fortunately, Flash offers another solution that may be a bit less intuitive.

The Solution

If you needed to create the same sort of control components purely using code (using Flex for example), your first step would likely be to create some sort of base class that implements the common functionality of the 4 controls. Here’s an example of a base class for these 4 controls.

package {

	import flash.text.*;
	import flash.display.*;
	import flash.events.*;

	public class AbstractVideoControl extends MovieClip {
		// you'll need to create this text field on the timeline
		// and set the instance name to "label"
		public var label:TextField;

		public function AbstractVideoControl() {
			label.visible = false;
			addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
		}

		protected function onMouseOver(event:MouseEvent):void {
			label.visible = true;
		}

		protected function onMouseOut(event:MouseEvent):void {
			label.visible = false;
		}
	}
}

Note: In many non-ActionScript languages, there is a construct called an “abstract type” which  is simply a base class that cannot be instantiated on its own, only extended. In Flash, proper abstract types don’t exist, but we can consider a class Abstract if it shouldn’t be instantiated without being subclassed. More on that at Wikipedia.

Next, let’s make our controls extend this class. For each symbol, check the Export for ActionScript box in the symbol properties. Since Flash can automatically generate classes for symbols when an .as file doesn’t exist, the only thing you’ll need to fill in is the Base Class field (later, you can create a class for PlayButton if you need one). Make sure you use the fully qualified name if you’re using packages.

picture-3

Moar

I found this technique was very useful for when I wanted to animate TextFields on the timeline. Timeline animations, as you probably are aware, only work with MovieClip symbols. That means that even simple animations on text require the text to be contained in a symbol. I created an AbstractTextFieldWrapper class so that I could easily work with animated type without having to create new classes every time the format changes.

package {
	import flash.display.MovieClip;
	import flash.text.TextField;

	/**
	 * This class allows you to create an animated text field on the
	 * timeline and still set the text of the field without creating a new
	 * class for each text field that does this.
	 *
	 * @use In the flash library, create a new movieclip symbol containing the
	 * 		textField. Make sure you set the instance name for the text field to
	 * 		"textField". Make the base class for the symbol
	 * 		"AbstractTextFieldWrapper".
	 * 		In another class, use the type AbstractTextFieldWrapper insatead of
	 * 		TextField for your text field variable.
	 */
	public class AbstractTextFieldWrapper extends MovieClip
	{
		public var textField:TextField;
		public function set text(text:String):void {
			textField.text = text;
		}
		public function get text():String {
			return textField.text;
		}
	}
}
Tagged , , , ,

New Prius Site is Hot! (Also, it uses KitchenSync)

by


The new Prius site by Saatchi & Saatchi and Bad Assembly looks awesome, has great sound design and feels really smooth. Oh, the car looks pretty hot too.

I caught word that KitchenSync was used for some of the animation! *Blush*