- class Dock extends MovieClip
- {
- var onEnterFrame, layout, icon_min, icon_max, icon_spacing, span, amplitude, ratio, items, width, createEmptyMovieClip, icon_size, _rotation, _parent, _name, ymouse, xmouse, tray_mc, _xmouse, _ymouse;
- function Dock()
- {
- super();
- this.setParameters();
- this.setLayout();
- this.createIcons();
- this.createTray();
- onEnterFrame = monitorDock;
- } // End of the function
- function setParameters()
- {
- layout = layout ? (layout) : ("bottom");
- icon_min = icon_min ? (icon_min) : (32);
- icon_max = icon_max ? (icon_max) : (96);
- icon_spacing = icon_spacing ? (icon_spacing) : (2);
- span = span ? (span) : (this.getSpan());
- amplitude = amplitude ? (amplitude) : (this.getAmplitude());
- ratio = 1.570796E+000 / span;
- } // End of the function
- function getSpan()
- {
- return ((icon_min - 16) * 180 / 80 + 60);
- } // End of the function
- function getAmplitude()
- {
- return (2 * (icon_max - icon_min + icon_spacing));
- } // End of the function
- function createIcons()
- {
- var _loc2;
- var _loc4;
- scale = 0;
- width = (items.length - 1) * icon_spacing + items.length * icon_min;
- var _loc3 = (icon_min - width) / 2;
- for (var _loc2 = 0; _loc2 < items.length; ++_loc2)
- {
- this.createEmptyMovieClip(String(_loc2), _loc2 + 10).attachMovie(items[_loc2].id, "_mc", 1);
- this[_loc2]._mc._y = -icon_size / 2;
- this[_loc2]._mc._rotation = -_rotation;
- this[_loc2]._x = this[_loc2].x = _loc3 + _loc2 * (icon_min + icon_spacing) + icon_spacing / 2;
- this[_loc2]._y = -icon_spacing;
- this[_loc2].onRelease = launchIcon;
- this[_loc2].useHandCursor = false;
- } // end of for
- } // End of the function
- function launchIcon()
- {
- _parent.callback(_parent.items[_name].label);
- } // End of the function
- function createTray()
- {
- var _loc4 = icon_min + 2 * icon_spacing;
- var _loc3 = width + 2 * icon_spacing;
- var _loc2 = this.createEmptyMovieClip("tray_mc", 1);
- _loc2.lineStyle(0, 13421772, 80);
- _loc2.beginFill(15263976, 50);
- _loc2.lineTo(0, -_loc4);
- _loc2.lineTo(_loc3, -_loc4);
- _loc2.lineTo(_loc3, 0);
- _loc2.lineTo(0, 0);
- _loc2.endFill();
- } // End of the function
- function setLayout()
- {
- switch (layout)
- {
- case "left":
- {
- _rotation = 90;
- break;
- }
- case "top":
- {
- _rotation = 180;
- break;
- }
- case "right":
- {
- _rotation = 270;
- break;
- }
- default:
- {
- _rotation = Number(layout);
- }
- } // End of switch
- } // End of the function
- function checkBoundary()
- {
- var _loc2 = 4 * scale;
- return (ymouse < 0 && ymouse > -2 * icon_spacing - icon_min + (icon_min - icon_max) * scale && xmouse > this[0]._x - this[0]._width / 2 - icon_spacing - _loc2 && xmouse < this[items.length - 1]._x + this[items.length - 1]._width / 2 + icon_spacing + _loc2);
- } // End of the function
- function updateTray()
- {
- var _loc2;
- var _loc3;
- _loc2 = this[0]._x - this[0]._width / 2 - icon_spacing;
- _loc3 = this[items.length - 1]._x + this[items.length - 1]._width / 2 + icon_spacing;
- tray_mc._x = _loc2;
- tray_mc._width = _loc3 - _loc2;
- } // End of the function
- function monitorDock()
- {
- var _loc2;
- var _loc5;
- var _loc3;
- var _loc4;
- if (xmouse == _xmouse && ymouse == _ymouse && (scale <= 1.000000E-002 || scale >= 9.900000E-001))
- {
- return (false);
- } // end if
- xmouse = _xmouse;
- ymouse = _ymouse;
- trend = trend == 0 ? (this.checkBoundary() ? (2.500000E-001) : (-2.500000E-001)) : (trend);
- scale = scale + trend;
- if (scale < 2.000000E-002 || scale > 9.800000E-001)
- {
- trend = 0;
- } // end if
- scale = Math.min(1, Math.max(0, scale));
- for (var _loc2 = 0; _loc2 < items.length; ++_loc2)
- {
- _loc3 = this[_loc2].x - xmouse;
- _loc3 = Math.min(Math.max(_loc3, -span), span);
- _loc4 = icon_min + (icon_max - icon_min) * Math.cos(_loc3 * ratio) * (Math.abs(_loc3) > span ? (0) : (1)) * scale;
- this[_loc2]._x = this[_loc2].x + scale * amplitude * Math.sin(_loc3 * ratio);
- this[_loc2]._xscale = this[_loc2]._yscale = 100 * _loc4 / icon_size;
- } // end of for
- this.updateTray();
- return (true);
- } // End of the function
- var scale = Number.NEGATIVE_INFINITY;
- var trend = 0;
- } // End of Class
Raw Paste