View Full Version : easing a slider with on(release)
studvicious
December 16th, 2003, 04:00 PM
Here goes... I've been working on this for a good while now and I can't FULLY get it to work, so I need some help..
I have a slider that controls my audio volume, it works great.. I also have stop and play buttons that (you guessed it) stop and play the audio... Now the effect that I'm going for is when you click the stop button the slider gracefully slides back to "zero" (which in my case it would be something like _x = -50) and when you hit the play button the slider would smoothly slide all the way to the right side of the slider (which would be _x = 50)..
I've gotten it to work to the point where when you click on the buttons they go to the right place but I'm having trouble easing them there... did that make sense?
senocular
December 16th, 2003, 04:05 PM
you want the play and stop buttons to adjust the volume slider? :huh:
studvicious
December 16th, 2003, 04:11 PM
yeah, like I said I've got it working EXCEPT for the fact that the slider doesn't ease from one place to the other... A perfect example of this would be
http://www.taigkhris.com/
Voetsjoeba
December 16th, 2003, 04:12 PM
MovieClip.prototype.easeX = function(to){
this.onEnterFrame = function(){
this._x = to-(to-this._x)/1.2
if(this._x > to-1 && this._x < to+1) delete this.onEnterFrame
}
}
//Usage:
yourmc.easeX(-50);
studvicious
December 16th, 2003, 04:13 PM
on what object do I place that... the button or the slider? thanks!
JustinM
December 16th, 2003, 04:15 PM
haha, I was just gonna post that same piece of code Voets. I got that prototype from you and I use it all the time!
JustinM
December 16th, 2003, 04:24 PM
Is the slider a mc within another mc? I usually place it in the top level of my mc. Say I have a menu mc with some mc buttons in it, I'll place it in the menu mc.
studvicious
December 16th, 2003, 04:32 PM
I have everything inside a main movie and then I have the slider and the buttons inside that movie..
MAIN // SLIDER MOVIE // SLIDER
MAIN // BUTTON MOVIE // BUTTONS
JustinM
December 16th, 2003, 04:40 PM
To start, try putting it in the slider movie, then yourmc.easeX(-50);
would refer to the actual button that slides. If you're still confused post your .fla. Now that I think about it, I'm getting confused.
studvicious
December 16th, 2003, 04:43 PM
lol, now you know how I feel... :crazy: I'll give it a shot, thanks man!
studvicious
December 16th, 2003, 04:55 PM
THANK YOU ALL!!!! I just tried it out and it works beautifully! thanks!
:p:
JustinM
December 17th, 2003, 08:41 AM
Sweet dude! Hang on to that prototype, it'll come in handy. I've modified it and used it many times. Check out this little menu I created based on it. http://www.trimerous.com/dev/ld/
studvicious
December 17th, 2003, 10:07 AM
nice! That blur effect is pretty sweet too... I'll be sure to hang on to it, I can already see many uses.. thanks again everyone.
:p:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.