Tutorial details:
Written by: Flashjunki
Difficulty Level: Intermediate
Requirements: Flash 4
Download FLA This tutorial will show how the value setter works.
To make it work, you will need several variables... "min" and "max" are where you preset your minimum and maximum values for the slider. You must also define the variable that the slider will be adjusting. For this example it is called "/:delay". You want a slider control to adjust "/:delay" between the values of "min" and "max".

The slider that appears has a width of 200. This was done for the simplicity of understanding the math. You might also want to replace all occurrences of "200" with another variable that you set before you get started... maybe call it "length", which represents the length of the slider's drag limit. But to keep things simple for this demonstration I have left that up to you. Out slider starts sliding at "0" and has a limit of "200".

When you start dragging the slider, Flash is continually checking the "X" value of the slider.(X is between 0 and 200).

Let's make this simple.... if you have a "min" of 0 and "max" of 4, and "X" was at 150.... what would be the value of your slider?

Well.... 150 is 75% of 200. (X/200=0.75)
And since "max" - "min" is 4.... we have 5 possible values for the slider. (Including zero)
0.75 * 4 (or, 75% of 4) is.... 3.

That's all this slider does. It figures out the percentage of the way across the slider bar it is, and multiplies that by the amount of possible values.
(The last thing it also does is compensates for ranges that do not begin at zero.)


To understand a little better, try changing the values of "min" and "max" and then running this again. Edit the object called "delay" on the main timeline. Go to Frame 2. Edit the triangle slider. They are in Frame 1.