Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Snapping Slider 1

Status
Not open for further replies.

theAntic

Technical User
Oct 7, 2003
26
0
0
US
Hi.

I'm trying to create a snapping slider that locks in at three different positions along its length. So far, I've been able to get it to snap at the end and beginning positions by simply defining positions nearing the extremes to = the extremes.

Example below:

Click here

But now I'm at a loss as to how to snap the middle position.. If I try specifying a position <= to the center, it conflicts with the beginning position (and >= with the end position) and it just sticks in the middle.

Here's the .fla

Thanks for your help!

- theAntic
www.etoddt.com​
 
Did you try figuring the middle and then moving a little outside of that for your center area?

So for example if your slider is 20px long, center is 10. Your script (just an example):

Code:
if(sliderName._x >= 9 && sliderName._x <= 11){
   sliderName._x = 10;
}

Hope it helps

Wow JT that almost looked like you knew what you were doing!
 
Now that I've got my nav integrated into my page, I notice that everytime my page refreshes my slider jumps back to a certain spot just off the left hang link. Is there a way I can specify a certain starting point to my slider?

[link ]Click here to see slider[/url]

Here's my code so far:

Code:
onClipEvent (enterFrame) {

 mx=_root._xmouse;
 if (mx<_x) {
 dx=_x-mx;
 }
 else {
 dx=mx-_x;
 }
 moveSpeedx=dx/3;
 if (mx<_x) {
 _x=_x-moveSpeedx;
 }
 else {
 _x=_x+moveSpeedx;
 }
 if (this._x>= 405){
	this._x = 440;  }
 if (this._x<= 130){
	this._x = 53;  }
 if(this._x >= 210 && this._x <= 320){
   this._x = 253; }
}

THANKS!

- theAntic
www.etoddt.com​
 
I have a very simple problem. My slider outputs to a textbox, but I don't want the numbers to appear above the slider when it moves. How can I prevent the numbers from appearing when the slider is moved?

Thank you,
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top