Slider

15 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.82
List Price:  €92.61
You save:  €27.78
£55.75
List Price:  £79.64
You save:  £23.89
CA$95.67
List Price:  CA$136.67
You save:  CA$41
A$105.86
List Price:  A$151.24
You save:  A$45.37
S$94.70
List Price:  S$135.29
You save:  S$40.59
HK$546.72
List Price:  HK$781.06
You save:  HK$234.34
CHF 63.51
List Price:  CHF 90.74
You save:  CHF 27.22
NOK kr756.09
List Price:  NOK kr1,080.17
You save:  NOK kr324.08
DKK kr483.66
List Price:  DKK kr690.98
You save:  DKK kr207.31
NZ$116.24
List Price:  NZ$166.07
You save:  NZ$49.82
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳8,184.61
List Price:  ৳11,692.81
You save:  ৳3,508.19
₹5,845.20
List Price:  ₹8,350.65
You save:  ₹2,505.44
RM330.31
List Price:  RM471.90
You save:  RM141.58
₦104,423.68
List Price:  ₦149,183.08
You save:  ₦44,759.40
₨19,463.92
List Price:  ₨27,806.80
You save:  ₨8,342.87
฿2,565.83
List Price:  ฿3,665.63
You save:  ฿1,099.80
₺2,257.71
List Price:  ₺3,225.44
You save:  ₺967.73
B$360.94
List Price:  B$515.65
You save:  B$154.71
R1,287.99
List Price:  R1,840.06
You save:  R552.07
Лв126.81
List Price:  Лв181.17
You save:  Лв54.35
₩95,704.32
List Price:  ₩136,726.31
You save:  ₩41,021.99
₪259.82
List Price:  ₪371.20
You save:  ₪111.37
₱4,043.91
List Price:  ₱5,777.27
You save:  ₱1,733.35
¥10,948.60
List Price:  ¥15,641.53
You save:  ¥4,692.93
MX$1,174.48
List Price:  MX$1,677.91
You save:  MX$503.42
QR255.13
List Price:  QR364.49
You save:  QR109.35
P950.42
List Price:  P1,357.81
You save:  P407.38
KSh9,133.69
List Price:  KSh13,048.69
You save:  KSh3,915
E£3,278.83
List Price:  E£4,684.25
You save:  E£1,405.41
ብር4,017.07
List Price:  ብር5,738.92
You save:  ብር1,721.84
Kz58,375.85
List Price:  Kz83,397.65
You save:  Kz25,021.80
CLP$64,738.65
List Price:  CLP$92,487.75
You save:  CLP$27,749.10
CN¥506.34
List Price:  CN¥723.38
You save:  CN¥217.03
RD$4,071.75
List Price:  RD$5,817.04
You save:  RD$1,745.28
DA9,401.76
List Price:  DA13,431.66
You save:  DA4,029.90
FJ$157.21
List Price:  FJ$224.60
You save:  FJ$67.38
Q543.50
List Price:  Q776.46
You save:  Q232.96
GY$14,642.77
List Price:  GY$20,919.14
You save:  GY$6,276.37
ISK kr9,755.90
List Price:  ISK kr13,937.60
You save:  ISK kr4,181.70
DH702.55
List Price:  DH1,003.69
You save:  DH301.13
L1,243.38
List Price:  L1,776.34
You save:  L532.95
ден3,995.02
List Price:  ден5,707.42
You save:  ден1,712.39
MOP$562.80
List Price:  MOP$804.03
You save:  MOP$241.23
N$1,285.58
List Price:  N$1,836.62
You save:  N$551.04
C$2,575.01
List Price:  C$3,678.75
You save:  C$1,103.73
रु9,348.21
List Price:  रु13,355.17
You save:  रु4,006.95
S/259.92
List Price:  S/371.34
You save:  S/111.41
K271.44
List Price:  K387.79
You save:  K116.35
SAR262.48
List Price:  SAR374.99
You save:  SAR112.50
ZK1,799.51
List Price:  ZK2,570.84
You save:  ZK771.33
L322.59
List Price:  L460.87
You save:  L138.27
Kč1,603.70
List Price:  Kč2,291.10
You save:  Kč687.39
Ft25,046.65
List Price:  Ft35,782.47
You save:  Ft10,735.81
SEK kr759.74
List Price:  SEK kr1,085.39
You save:  SEK kr325.65
ARS$61,888.08
List Price:  ARS$88,415.34
You save:  ARS$26,527.25
Bs483.35
List Price:  Bs690.53
You save:  Bs207.18
COP$271,323.12
List Price:  COP$387,621.07
You save:  COP$116,297.95
₡35,845.23
List Price:  ₡51,209.67
You save:  ₡15,364.43
L1,728.98
List Price:  L2,470.08
You save:  L741.10
₲525,197.80
List Price:  ₲750,314.73
You save:  ₲225,116.93
$U2,696.53
List Price:  $U3,852.35
You save:  $U1,155.82
zł276.95
List Price:  zł395.67
You save:  zł118.71
Already have an account? Log In

Transcript

Hello, here is another multimedia video tutorial by arrow media. Today we are going to take a look at creating property change sliders for a movie clip. You just click and drag the mouse over the slider and the object changes it said properties. So, let's see how to create this using ActionScript 3.0. We will start with a new flash document. The very first thing we need is the object.

Draw a circle and delete its outline. Press f8 to convert it into a movie clip named object. Move its registration point to the exact center. This is the object whose properties are planned to change. So give an instance name, object underscore MC. Also name its lair as object Next thing that will appear on stage is the slider.

This slider will control the properties of the object. So we name its layer control. The controller movie clip will be created with the line and rectangle tools. The line will be the controller's drag and rectangle will be its knob. So firstly draw a line. Keep it with fixed 200 pixels.

Convert that line into a movie clip keeping the registration point and center left. Name it control. This is supposed to complete the controller inside which the track and knob will be found. Step inside it and convert that line into a new movie clip called line. Make sure it's registration point should also be at center left this lines with To be used in the ActionScript. So give it an instance name as line underscore MC, and also name its layer as line.

Similarly, on another layer, let's create the sliders knob, draw a rectangle, delete its outline. Fix the knobs with to 10 pixels and hide to 20 pixels. Also convert the knob to a movie clip, keeping the registration point that center left name it knob. This knob should move on the about track. So let's align them. Ctrl plus k is the shortcut for the Align panel.

The knob is placed on the extreme center left of the track. We still have not named the norm. So name it now. Score MC. This controller will control the alpha value of the object movie clip. So, label it alpha.

This controller will be used in the action script. So give it an instance name, alpha underscore MC. Now, everything needed is ready with us along with the instance names. Moving ahead to add action script, get a new layer for it named action. We can change the object's x y coordinates using the ActionScript. Open the action panel and start give the x value equal to 400.

And why equal to 250 You won't see the change in object position on stage, but you can see it in the output. Now, we want to drag the knob on the slider. So let's add the action script for this. Start with the function of the start drag on the mouse event. We don't want locks enter, so type false for it. The knob should be dragged only on these sliders particular path.

So let's bind it in its value. x will be zero ny will be zero drag length will be equal to the sliders weight. So use that the height will also be zero. Now, by using the event listener called the about function on the knob done. Now let's face the movie, nobody's dragging on mouse down. This drag should stop on mouse up.

So, again, open the action bundle and add a script, describe the function of stop drag and then add the mouse up event listener on the knob. Ctrl plus enter. The knob stops when the mouse is up. Similarly, dragging should stop when the mouse is rolled out of the knob. Again, open the action panel and just add an event listener on the knob to stop drag on mouse out. Guess the movie, even when the mouse is down, but moved out of the knob, the knob drag stops.

So finally, the slider is ready. Now, let's set the object's alpha value on the knobs position. For this, we have to first add a function, which will later be called on the knobs enter frame. Start with the function, this will not be a mouse event. This will depend on the knobs enter frame. So, just use event in here we have to relate the objects alpha value to the NURBS exposition.

This exposition can be seen In between zero to hundred, and the alpha value can be set in between zero to one. So the knobs exposition is to be divided by hundred. Here we complete the function now, let's call this function on the knobs enter frame event. Time to test the movie. Currently, the knobs exposition is zero That is why the objects alpha value is also zero, and so it's not visible. start dragging the knob and see, the object varies it's alpha value.

Depending on the knobs position, the object is completely visible. When the knobs position is on the highest, and the object completely hides. When the knob comes fully down. You can say we are ready with the objects alpha property slider. Similarly, we can add one more slider, which will move the object on its y axis depending on the knobs exposition. For that we need one more slider make a copy of the earlier slider and modify its level to position why.

Even modified the new sliders instance name to position y underscore MC Press f9 on the action layer to get the action panel. Already we have the object y position decided here. We even have the alphas complete script here, which will be similar to the new slider script as well. So, at first, we will name the Ready Action as alpha and about that store the objects existing y position in a variable. And now let's start with the new position why ActionScript below. Similarly, to the alpha controllers, no functions and the event listeners to start and stop drag on the slider.

We are ready with the position why controllers not functions and mouse up mouse down, mouse out event listeners to start Stop the drag of the knob on its relative slider. Let's see the output of this. The alphas knob was already moving on the track. Position wise knob is also sliding on its track correctly. Now, only the ActionScript to move the object on its y position remains open the action panel. The objects y position will depend on the knobs exposition on the slider.

This will take place on the call of the knobs on Event Frame event. So let's first add a function for this. Add the objects current position which is stored in a variable And then from that, minus the knobs x value. Now call this function on the knobs enter frame event. Test the movie. Firstly, increase the object's alpha to make it appear.

And now along with the position y now, the object is moving on its y axis, we have detected the knobs x value from the objects existing position. Similarly, we can even add that value, increase the alpha value and see the difference now. Earlier, the object was moving upwards while the knob was moving on the higher side, but this time the object is moving downwards. This difference was created by adding and subtracting the knobs x value from the objects by position. Similarly, you can add some more properties sliders here and create your own controls. You must have noticed that a single Change in the ActionScript gives you a different output.

We are sure this was a useful tutorial brought to you by our Roja media. See you in the next tutorial. Till then, keep watching and keep exploring

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.