PDA

View Full Version : how would you make a diagonal slider?



georgekaplin
May 20th, 2002, 07:58 AM
How would you script the movement limitations to create a diagonal slider? Im not looking for anything tricky. Just a plain 45 degree, .785 rads, um i think ;) angle movement.


My current Horizontal slider is as follows.

onClipEvent (load) {
&nbsp &nbsp &nbsp &nbsp min=50;
&nbsp &nbsp &nbsp &nbsp max=400;
&nbsp &nbsp &nbsp &nbsp percent = Math.floor((_x-min)/(max-min)*100);
}

onClipEvent (mouseMove) {
&nbsp &nbsp &nbsp &nbsp if (drag==1){
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _x=_root._xmouse+offsetX;
&nbsp &nbsp &nbsp &nbsp if (_x>400){
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _x=400;
&nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp if (_x<50){
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _x=50;
&nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp percent = Math.floor((_x-min)/(max-min)*100) ;
&nbsp &nbsp &nbsp &nbsp updateAfterEvent ()}
}

I am not Jubba
May 20th, 2002, 09:18 AM
change both the X and Y values instead of just the X. And use the same method for making the constraints. Make sure you change the values and an equal rate to get a 45 degree slant.

RenaissanceGirl
May 20th, 2002, 01:27 PM
I had this problem a while back - put everything in it's own MC and create it straight - either horizontal or diagonal. Drag an instance of the scroller to the main timeline and rotate it. I found this to work most consistently.

georgekaplin
May 20th, 2002, 09:38 PM
that is a great idea!

I can't believe I never thought of that!

-georgekaplin