Mac OS X Style Dock in Flash 7 (ActionScript 2.0)

This is the new improved version of the Flash Dock wrapped in an ActionScript 2.0 class. We included an example that is easy to customize. See the code below that is used to create this dock. The rest is in the Dock.as ActionScript class.

Download Source File: Flash7_Dock.zip

Code:

// Handles clicks on icons
this.dockActions = function(label) {
	switch(label) {
		case 'Preferences':
			trace('This is how you open a URL in a new window.');
			getURL('http://opera.com/', '_blank');
			break;
		case 'Blog':
			trace('This is how you load a JPEG or SWF into a new level.');
			loadMovie('sample.jpg', '_level10');
			break;
		case 'Forum':
			trace('This is how you load a JPEG or SWF into a movieclip.');
			this._parent.sample_mc.loadMovie('sample.jpg');
			break;
		default:
			trace('Default action here.');
	}
}

// Dock description
var dockTemplate = {
	layout: 0, /* top | right | bottom | left | *rotation* */
	icon_size: 128,
	icon_min: 32,
	icon_max: 120,
	icon_spacing: 2,
	items: [
			{ id: 'settings', label: 'Preferences'},
			{ id: 'blog', label: 'Blog' },
			{ id: 'forum',label: 'Forum' },
			{ id: 'shop', label: 'Store' },
			{ id: 'support', label: 'Tech Support' },
			{ id: 'search', label: 'Search Archives' },
			{ id: 'contact', label: 'Contact Us' },
			{ id: 'trash', label: 'Trash' }
			],
	span: null,
	amplitude: null,
	callback: this.dockActions
}

this.attachMovie('Dock', 'menu_mc', 1, dockTemplate);
this.menu_mc._x = Stage.width / 2;
this.menu_mc._y = 232;