hallo
ich habe am we begonnen mir einen scroller zubasteln!
funzt eigentlich auch schon soweit aber es gibt ein mir mysteriös
erscheinendes problem!
erstmal der code:
ActionScript:
TextField.prototype.scroller = function(h_mcFarbe, h_mcLineFarbe, b_mcFarbe) {
var h_mc = mcCreator(this._name+"bg_mc", _root.getNextHighestDepth(), 11, this._height, h_mcFarbe, h_mcLineFarbe, 1, 100, this._x+this._width, this._y, false);
var b_mc = mcCreator(this._name+"_mc", _root.getNextHighestDepth(), 10, 50, b_mcFarbe, NULL, NULL, 100, this._x+this._width+1, this._y+1, true);
var t_mc = this;
var oben = this._y;
var unten = (t_mc._height+t_mc._y)-b_mc._height;
b_mc.onPress = function() {
var posOnMc = _root._ymouse-this._y;
ownCourser(true);
this.onEnterFrame = function() {
this.moveToY(_root._ymouse-posOnMc, t_mc._y, (h_mc._height+h_mc._y)-b_mc._height, 10);
t_mc.scroll = -(Math.round(((this._y-oben)/(this._height-t_mc._height))*t_mc.maxscroll));
};
};
b_mc.onRelease = b_mc.onReleaseOutside=function () {
ownCourser(false);
this.onEnterFrame = NULL;
};
};
//hier ist mein problem
MovieClip.prototype.moveToY = function(Y, Ymin, Ymax, speed) {
//funktioniert komischerweise nicht??
Y>=Ymin ? this._y += (Y-this._y)/speed : this._y=Ymin;
//das aber tadelos mhhh...
Y<=Ymax ? this._y += (Y-this._y)/speed : this._y=Ymax;
};
//
function mcCreator(mc, tiefe, breite, hoehe, hFrabe, bFarbe, lStarke, alpha, x, y, onOff) {
this[mc] = this.createEmptyMovieClip(mc, tiefe);
with (this[mc]) {
lineStyle(lStarke, bFarbe, alpha);
beginFill(hFrabe, alpha);
lineTo(0, 0);
lineTo(breite, 0);
lineTo(breite, hoehe);
lineTo(0, hoehe);
lineTo(0, 0);
endFill();
}
this[mc]._x = x;
this[mc]._y = y;
this[mc].enabled = onOff;
return this[mc];
}
function ownCourser(showOrHide) {
if (showOrHide) {
var mc = _root.attachMovie("upDown", "mc", _root.getNextHighestDepth());
Mouse.hide();
mc.onEnterFrame = function() {
mc._x = _root._xmouse;
mc._y = _root._ymouse;
};
} else {
mc.removeMovieClip();
Mouse.show();
}
}
der balken läst sich oben aus seinem funktionbereich rausscheiben was nicht sein dürfte da:
ActionScript:
//da ja hier überprüft wird ob dieser überschreiten und wenn zurücksetzt
Y>=Ymin ? this._y += (Y-this._y)/speed : this._y=Ymin;
das ganze funzt aber bei der unteren grenze??
hab keinen dunst warum?!
hänge mal funktiontüchtige files an!