Scriptprofis an die Front !
Problem:
Ich habe einen simplen Mauszeiger generiert, der den Systemzeiger ausblendet und einen eigenen MC stattdessen anzeigt. Dieser Mauszeiger crasht aber mit dem Scrollbalken einer dynamischen Textbox: Sobald ich den Scrollbalken mit dem Mauszeiger anklicke, bleibt der MC des Zeigers am Scrollbalken hängen. Die Systemmaus funktioniert weiterhin, bleibt aber natürlich unsichtbar.
Hier das simple Script des Zeigers:
PHP-Code:
onClipEvent (load) {
startDrag (this, true);
Mouse.hide();
}
Und das Script des Scrollbalkens (Eine Gratiscomponente von "www.flashstar.de" = "Scrollbalken 2006 v5":
PHP-Code:
function init (hoehe, feld, raktiv)
{
signal = false;
regler._visible = false;
regler._alpha = 100;
hoch.arrow._alpha = 50;
runter.arrow._alpha = 50;
hintergrund._height = Math.round (hoehe - hoch._height * 2);
reglermaske._height = hintergrund._height;
runter._y = hintergrund._height + runter._height;
this.finstanz = feld;
if (raktiv == true)
{
setzeRahmen ();
}
setzePruefer ();
setzeMausrad ();
}
Color.prototype.setzeFarbton = function (f, p)
{
this.setRGB (f);
var t = this.getTransform (), r = (100 - p) / 100;
this.setTransform ({ra:p, rb:t.rb * r, ga:p, gb:t.gb * r, ba:p, bb:t.bb * r});
};
function setzeMausrad ()
{
maus_obj = new Object ();
maus_obj.onMouseWheel = function (delta)
{
if (_level0._xmouse > finstanz._x && _level0._xmouse < finstanz._x + finstanz._width)
{
if (_level0._ymouse > finstanz._y && _level0._ymouse < finstanz._y + finstanz._height)
{
finstanz.scroll -= delta;
}
}
};
Mouse.addListener (maus_obj);
}
function setzePruefer ()
{
regler.useHandCursor = false;
regler.onRollOver = function ()
{
this._alpha = 100;
};
regler.onRollOut = function ()
{
this._alpha = 100;
};
regler.onPress = function ()
{
this.startDrag (false, 0, 0, 0, hintergrund._height - this.balken._height);
signal = true;
this._alpha = 100;
};
regler.onRelease = function ()
{
this.stopDrag ();
this._alpha = 100;
signal = false;
};
regler.onReleaseOutside = function ()
{
this.stopDrag ();
signal = false;
this._alpha = 100;
};
hoch.useHandCursor = false;
hoch.onRollOver = function ()
{
this.arrow._alpha = 100;
};
hoch.onRollOut = function ()
{
this.arrow._alpha = 50;
};
hoch.onPress = function ()
{
if (regler._visible)
{
startScroll (-1, 2);
}
};
hoch.onRelease = function ()
{
stopScroll ();
};
hoch.onDragOut = function ()
{
stopScroll ();
this.arrow._alpha = 50;
};
runter.useHandCursor = false;
runter.onRollOver = function ()
{
this.arrow._alpha = 100;
};
runter.onRollOut = function ()
{
this.arrow._alpha = 50;
};
runter.onPress = function ()
{
if (regler._visible)
{
startScroll (1, 2);
}
};
runter.onRelease = function ()
{
stopScroll ();
};
runter.onDragOut = function ()
{
stopScroll ();
this.arrow._alpha = 50;
};
this.onEnterFrame = function ()
{
getPosition ();
reglerNachzeichnen ();
};
}
function startScroll (schritte, tempo)
{
if (tempo == undefined)
{
tempo = 2;
}
signal = true;
hintergrund.onEnterFrame = function ()
{
regler._y += (schritte * tempo);
if (regler._y < 0)
{
regler._y = 0;
}
if (regler._y > hintergrund._height - regler.balken._height)
{
regler._y = hintergrund._height - regler.balken._height;
}
};
}
function stopScroll ()
{
signal = false;
delete hintergrund.onEnterFrame;
}
function getPosition ()
{
if (signal)
{
var reglermax = hintergrund._height - regler.balken._height;
var reglerpos = regler._y;
var prozent = reglerpos * 100 / reglermax;
var absolutepos = prozent * (finstanz.maxscroll - 1) / 100 + 1;
finstanz.scroll = int (absolutepos);
}
else if (regler._visible)
{
var zeilenpos = (finstanz.scroll - 1) * 100 / (finstanz.maxscroll - 1);
var reglermax = hintergrund._height - regler.balken._height;
regler._y = zeilenpos * reglermax / 100;
}
}
function reglerNachzeichnen ()
{
var relation = (finstanz.maxscroll + (finstanz.bottomScroll - finstanz.scroll) - 1) / (finstanz.bottomScroll - finstanz.scroll);
var alteHoehe = regler.balken._height;
regler.balken._height = Math.round (hintergrund._height / relation);
if (regler.balken._height < 10 && regler.balken._height > 0)
{
regler.balken._height = 10;
}
if (regler.balken._height != alteHoehe)
{
regler.linienNachzeichnen ();
}
if (regler.balken._height < hintergrund._height)
{
regler._visible = true;
}
else
{
regler._visible = false;
}
}
function setzeRahmen ()
{
this.createEmptyMovieClip ("rahmen", 1);
rahmen._y = -16;
rahmen.clear ();
rahmen.lineStyle (1, 0x776655, 100);
rahmen.moveTo (0, hintergrund._height + hoch._height + runter._height);
rahmen.lineTo (0, 0);
rahmen.lineTo (hintergrund._width - 1, 0);
rahmen.lineTo (hintergrund._width - 1, hintergrund._height + hoch._height + runter._height);
rahmen.lineTo (0, hintergrund._height + hoch._height + runter._height);
}
// Parameterwerte
if (reglerhoehe == 0)
{
init (_parent[_targetInstanceName]._height, _parent[_targetInstanceName], rahmenaktiv);
}
else
{
init (reglerhoehe, _parent[_targetInstanceName], rahmenaktiv);
}
farbe = new Color (this);
farbe.setzeFarbton (reglerfarbe, reglerfarbabstufung);
Wer die Nuss knacken kann ist meiner ewigen Dankbarkeit gewiss.