PDA

View Full Version : scroll, onRelease stop scroll (mx)



smacklemore
May 23rd, 2003, 11:48 AM
Hi there,
I thought I would be able to find a tut somewhere for this, but amazingly no.

Does anyone know how to make a mc scroller that uses up and down buttons (no bar), that starts scrolling onPress and stops on onRelease... but eases into place wherever you happen to stop?

smacklemore
May 23rd, 2003, 03:32 PM
Well,
I think I sort of answered my own question, but I doubt this is the best, most efficient way to do this.

I'm using this prototype:

MovieClip.prototype.easeScale = function (finalx, finaly, speed) {
this.onEnterFrame =function () {
this._x += Math.floor ((finalx- this._x )/speed);
this._y += Math .floor ((finaly- this ._y )/speed);
if (Math.abs (this._y - finaly) < .001) {
delete this.onEnterFrame;
}
};
};


... and on the up button I have:


on (press) {
***raText_mc.easeScale(0, 31, 9);
}
on (release, dragOut) {
if (***raText_mc._y >= 31){
***raText_mc.easeScale(0, 31, 6);
}
else {
***raText_mc.easeScale(0, (***raText_mc._y + 10), 6);
}
}

...and on the down button:

on (press) {
***raText_mc.easeScale(0, (***raText_mc._y - ***raText_mc._height), 10);
}
on (release, dragOut) {
***raText_mc.easeScale(0, (***raText_mc._y - 10), 6);
}

Does anyone have any suggestions?

smacklemore
May 24th, 2003, 08:49 PM
No, seriously. Does anyone have a better way to do this? Or is this just one of those questions that gets asked too much? If so, please point me to a tutorial and accept my appology for boring you.