Apple style OS X Dock in Macromedia Flash MX 2004

Macromedia Flash MX 2004   Download SWF    Download zipped FLA

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

// 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;

This is very sweet, here it is built into a standalone app with the latest version of mProjector http://homepage.mac.com/allotrope/dock.zip (you will get a page not found but the app will download) I did not add any hook in for dragging or actually opening stuff, but that would be easy to do.

Beautiful! Well done. I am having no problems with this in Firefox 1.0.2. However, in IE 6.0.29x, the navigation disappears ONLY after I refresh the page. I have hunted all over for thoughts on why this would happen only in IE. Any ideas?

It works fine in IE 6.0.28/Win2k with Flash Player 7. I have no idea why it breaks on your box. Could it be your Flash Player? Anybody knows the answer please let us know.

Fantastic script! It doesn't seem to work when nested inside another .swf with the loadMovie function, though. I've tried everything I can think of (_lockroot=true, Actionscript 1 or 2, etc.) but no dice. Any ideas?

I tested the following and it works fine:

this.createEmptyMovieClip('shell_mc', 1);
this.shell_mc.loadMovie('Dock.swf');


Use relative path like _parent and this when nesting and it should work. You can even create multiple docks.

Are there supposed to be titles above the icons? If so, I am not seeing them I am running OSX 10.3.8 in Safari.

Icon labels and icon bouncing are on the todo list. When we have time we will add these features to make the dock cooler.

How to edit it? I have made my own icons in PNG, and converted them into movie clips, and changed the items. But it won't work :(

Make sure you 'Export for ActionScript'. You should start your dock by modifying the existing icons included in the zip file.

  1. great job!... how can i remove or hide the gray background? thnx!
  2. I love it! But one question? How do I get rid of the box behind the icons?

Use PNG with Alpha transparency. Most Mac OS X applications have 32bit PNG icons. You can find these by selection the 'Show Package Contents' option in Finder.

COMMENTS ARE CLOSED
Sorry, I do not have time to answer questions related to these scripts.
You can always get help on the Kirupa Flash Forums. Thank you for visiting.