# How would you make a diagonal slider?

**URL:** <https://forum.kirupa.com/t/how-would-you-make-a-diagonal-slider/2637>\
**Category:** Uncategorized\
**Created:** [May 20, 2002, 11:58am UTC](https://forum.kirupa.com/t/how-would-you-make-a-diagonal-slider/2637 "2002-05-20T11:58:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 11:58am UTC](https://forum.kirupa.com/t/how-would-you-make-a-diagonal-slider/2637/1 "2002-05-20T11:58:09Z")

</div>

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.\r\r\rMy current Horizontal slider is as follows.\r\ronClipEvent (load) {\r&nbsp &nbsp &nbsp &nbsp min=50;\r&nbsp &nbsp &nbsp &nbsp max=400;\r&nbsp &nbsp &nbsp &nbsp percent = Math.floor((\_x-min)/(max-min)\*100);\r}\r\ronClipEvent (mouseMove) {\r&nbsp &nbsp &nbsp &nbsp if (drag==1){\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_x=\_root.\_xmouse+offsetX;\r&nbsp &nbsp &nbsp &nbsp if (\_x\>400){\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_x=400;\r&nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp if (\_x\<50){\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_x=50;\r&nbsp &nbsp &nbsp &nbsp }\r&nbsp &nbsp &nbsp &nbsp percent = Math.floor((\_x-min)/(max-min)\*100) ;\r&nbsp &nbsp &nbsp &nbsp updateAfterEvent ()}\r}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 1:18pm UTC](https://forum.kirupa.com/t/how-would-you-make-a-diagonal-slider/2637/2 "2002-05-20T13:18:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2002, 5:27pm UTC](https://forum.kirupa.com/t/how-would-you-make-a-diagonal-slider/2637/3 "2002-05-20T17:27:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 21, 2002, 1:38am UTC](https://forum.kirupa.com/t/how-would-you-make-a-diagonal-slider/2637/4 "2002-05-21T01:38:57Z")

</div>

that is a great idea!\r\rI can’t believe I never thought of that!\r\r-georgekaplin
