beckersbesters
Mitglied
Hallo.
Ich habe ein Problem. Das Navigations-Dock soll nur reagieren wenn die Mouse wirklich direkt auf dem Dock ist, und nicht über oder unter dem Doch.
Hier der Code (ansonsten siehe Anhang):
Danke Gruß
Ich habe ein Problem. Das Navigations-Dock soll nur reagieren wenn die Mouse wirklich direkt auf dem Dock ist, und nicht über oder unter dem Doch.
Hier der Code (ansonsten siehe Anhang):
Code:
function doDock() {
this.onEnterFrame = function() {
if (this._alpha < 100) {
this._alpha += 10;
}
if (state == 0 || state == 1) {
temp = false;
} else {
temp = true;
}
if (inside) {
state = Math.min(1, state + 0.2);
} else {
state = Math.max(0, state - 0.2);
}
if (x != _xmouse || y != _ymouse || temp) {
var x = _xmouse;
var y = _ymouse;
var x1 = tray._x;
var x2 = x1 + tray._width;
if (!temp) {
if (x < x1 || x > x2 || Math.abs(y) > altitude) {
inside = false;
} else {
inside = true;
}
}
var altitude = min + 2 * margin + _s * state;
for (i = 1; i <= n; i++) {
lo = center[i] - state * span;
hi = center[i] + state * span;
if (x <= lo) {
iX = hi;
}
// mouse on the left, icon to the right
if (x >= hi) {
iX = lo;
}
// mouse on the right, icon to the left
if (x > lo && x < hi) {
// icon is influenced by mouse
fi = piSpan * (hi - x);
// 0..2pi
cfi = _MC(fi / 2);
// 1..-1
sfi = _MS(fi) / 20;
// horizontal compensation
iX = center[i] - state * span * (cfi + sfi);
// centrum ± span
iSize = _s * (1 - cfi * cfi);
// icon resize
} else {
iSize = 0;
}
_scale = 100 * (min + state * iSize) / 128;
this[i]._xscale = this[i]._yscale = _scale;
this[i]._x = iX;
}
tray._width = this[n]._x - this[1]._x + this[1]._width / 2 + this[n]._width / 2 + 2 * margin;
tray._x = this[1]._x - this[1]._width / 2 - margin;
}
};
}
var posx = 0;
var n = 10; // number of icons
for (var i = 1; i <= n; i++) {
this.attachMovie("icon", i, i);
this[i]._x = posx;
this[i]._xscale = 25;
this[i]._yscale = 25;
this[i].id.autoSize = "center";
this[i].id.text = i;
posx += 32;
}
var margin = 2; // tray margin
var min = 32; // icon size at its smallest
var max = 92; // icon size at its largest
var span = 2.5 * min; // radius of influence
var spacing = min + 1; // icon spacing
var speed = 0.15;
var _MC = Math.cos;
var _MS = Math.sin;
var _s = max - min;
var state = 0;
var piSpan = Math.PI / span;
var center = new Array();
for (i = 1; i <= n; i++) {
this[i]._y = -margin;
center[i] = (2 * i - n - 1) * spacing / 2;
}
tray._height = min + 2 * margin;
this._alpha = 0;
doDock();
Danke Gruß