ActionScript 3 Minimal Comps for Quick Prototyping

Recently, Keith Peters has been putting overtime into his Minimal Comps library. It’s an ActionScript 3 library that offers a large number of typical user interface components. Easily and quickly you can construct basic user interfaces in ActionScript. When Flex is a little too heavy, this is a really neat solution.

This is basically the most minimal minimal component application you’re going to see:

package 
{
	import com.bit101.components.PushButton;
	import flash.display.Sprite;
	import flash.events.Event;
	import org.flashdevelop.utils.FlashConnect

	public class Main extends Sprite
	{
		public function Main():void
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);

			new PushButton(this, 100, 100, "Click me", onBtnClick);
		}

		private function onBtnClick(e:Event):void
		{
			FlashConnect.trace("clicked");
		}
	}
}

Inspired by this minimal tutorial and written for FlashDevelop (remove the FlashConnect statements if you’re working in another editor).

BTW I wanted to give a demonstration where I integrated the YouTube data API, but it appears that none of the libraries are really up-to-date and/or well enough documented to get started in under 15 minutes. This one comes closest, but if you have a good suggestion, please let me know.

(image credit)