Man muss einmal den Startaufruf definieren, damit alles beim Aufruf ausgerichtet wird (onLoad) und dann dafür sorgen, dass nur dann eine Aktion von onEnterFrame erfolgt, wenn die Mouse im Bereich liegt.
PHP-Code:
xm = 0;
//function to set the xpos of the movieclip
function xpos(bar_length, mul) {
if (_ymouse>=bar._x && _ymouse<=(bar._height)) {
hpos = 0;
scroll_length = 420;
incr = bar_length/scroll_length;
xm = _xmouse;
if (_xmouse<=10) {
xm = 10;
}
if (_xmouse>=400) {
xm = 400;
}
scroll_x = hpos-xm;
scroll_x = scroll_x*mul;
x_pos = scroll_x*incr;
x_pos = x_pos+hpos;
return x_pos;
}
}
_root.onEnterFrame = function() {
if (_ymouse>=bar._x && _ymouse<=(bar._height)) {
// call function xpos
x_pos = xpos(700, .20);
with (bar) {
_x += (x_pos-_x)*.4;
}
// call function xpos
x_pos = xpos(950, .75);
with (menu) {
_x += (x_pos-_x)*.4;
}
}
};
_root.onLoad = function() {
// call function xpos
x_pos = xpos(700, .20);
with (bar) {
_x += (x_pos-_x)*.4;
}
x_pos = xpos(950, .75);
with (menu) {
_x += (x_pos-_x)*.4;
}
};