PDA

View Full Version : alpha slider



iceman
January 10th, 2004, 12:41 AM
Hey everyone,

I was wondering if someone could help put an end to my bitter struggle. I have a slider ball and its movement is contained and I want its position to correspond to the alpha level of another movieclip. I've been struggling with this for a while now and can't figure it out...I'm sure this will be easy for many of you..so I'm hoping to figure something out. Here is the code: top = borderMC._y-borderMC._height/2+sliderMC._height/2;
bottom = borderMC._y+borderMC._height/2-sliderMC._height/2;
side = borderMC._x;
sliderMC.onPress = function() {
this.startDrag(false, side, top, side, bottom);
};
sliderMC.onRelease = function() {
this.stopDrag();
};
sliderMC.onEnterFrame = function() {
if (sliderMC._y == bottom) {
alphaMC._alpha = 0;
} else if (sliderMC._y == top) {
alphaMC._alpha = 100;
}
};
Anyways if anyone could help that would be great!

Thanks

Kyle:p:

GreenLantern
January 10th, 2004, 02:32 AM
http://www.kirupa.com/developer/mx/slider.htm

Try that.

Uli
January 10th, 2004, 02:36 AM
hmm not easy to read without your .fla...
But as i can understand , you wanna test your drag button position and affect the alpha of a MC depending on that.

i'd do like that :
MCSlide beeing the MC of the background of your "slider"
MCbouton beeing the MC of the drag button
The trick is to calculate the distance the button is from its origin.



}
onClipEvent(enterFrame){
var b = _root.MCSlide._height;
var c = _root.MCbouton._y;
var d = _root.MCSlide._y
var e = _root.MCbouton._height;
//var f = distance
if(c <= (d + b -e)){f = c + d}
if(c >= d){f = c - d}
_root.MCalpha._alpha = (f*100)/(d+b)

Scootman
January 10th, 2004, 05:17 PM
ohh heh bit-101 has a slider component you should check out

http://www.bit-101.com/slider/