CLSlider problem

Hey all , need a helping hand on this text slider. Its working fine, just that when you drag the slider to the top and to the bottom it kinda goes off the track.

just wondering how to keep it in the track.

check the fla out.

thanx

If you mean the slider itself… I experience no problem with that.

I do see the text is a tad bit off though. Is that what you meant?

nah no problems with it working, just when you drag the slider all the way down it goes off the slider track , same for up

not totally off, it offsets out of the slider track a few pixels,

I experience the same thing I do if I use the buttons to scroll. It really doesn’t seem like a problem to me. In fact, I would have just thought it was an intentional thing if you didn’t point out that it wasn’t.

But I was messing around for a second here and believe I fixed it.

Double click on your movie clip, then on the scrollbar draggable object, then click on the object in there and open the actions panel so you can edit the code… change it to this…

on (press) {
	startDrag(this, false, _parent.left, _parent.track._y-((_parent.track._height)/2-5)+((this._height)/2), _parent.right, _parent.track._y + ((_parent.track._height)/2-5)-((this._height)/2));
}
on (release, releaseOutside) {
	stopDrag();
}

This however does not fix the problem for the up and down buttons.

Hmmm, for the buttons, it seems removing some if statments work.

On the actions on frame 5, change them just to read the second if statement (delete the first one) so it just reads…

if ((sliderButton._y<(bottom)) && ((sliderButton._y+speed)<=bottom)) {
	setProperty("sliderButton", _y, sliderButton._y+speed);
}

And edit Frame 10 the same way…

if ((sliderButton._y>(top)) && ((sliderButton._y-speed)>=top)) {
	setProperty("sliderButton", _y, sliderButton._y-speed);
}

Edit: Hmmm… seems that this only works for the down button every other time you click on it. It always works for the top button, but if you click on the drag bar the first time it works, then if you click again, it doesn’t, and click once more it does again, etc.

Weird… I don’t have much time to fiddle with it, so hopefully these were some points in the right direction.

thanx dude, works fine. i knew i had to change something though i couldnt find it, ill try to figure out the buttons as well , was just writing this and you sent another post, lol, i ll try those if statements as you said, thanx

by the way can i bother you for one more issue, would you be able to check out the inactive buttons post in the same thread.

Need to know how to go around doing a inactive button and other things mentioned at that post.

got it working, :slight_smile:

i kept the if statements coz they were for the easing of the slider as it got closer to the bottom and top, all i had to do was change the ratio like before in first frame,



// Set Variables for Scrollbar and text box
top = (track._y-((track._height)/2-5))+((sliderbutton._height)/2);
left = sliderButton._x;
right = sliderButton._x;
bottom = track._y+((track._height)/2-5)-(((sliderbutton._height)/2));
initY = sliderButton._y;


all i did was change the

top = (track._y-((track._height)/2))+((sliderbutton._height)/2);

to:

top = (track._y-((track._height)/2-5))+((sliderbutton._height)/2);

as you did before, same for bottom.

works great now , thanx :slight_smile:

Awesome!

Great job man.

Hey all.

would i be able to use this slider in different external movies with the same code applied to it without changing any code such as instance names and all that?

and this is with the the target load movie method.

I don’t see why it won’t work.

Give it a shot, see if it does.

ok kool, setting it up now

yeah works fine, though might be one problem in the future. Iam creating this swf , this two section in it, these both will have text content in it. So would i be able to use the same slider, or would i have to create two completely different sliders.

All i really need to do is change the content of the type for each section.

No, since all instance names are contained within the respected clips I don’t think their will be any interference with that.

though i might need to create and rename the text field though, wont i?

all good dude, i figured it out, all i had to do was duplicate the slider_mc and the the mc that holds the type , type_mc.

so i could have 2 of the same slider with diff type.

Cool. Congrats.