FrozenHaddock Tutorials: Introduction to Variables

In this tutorial you will learn how to make an variable textbox containing a number, then make buttons to alter it's value.

first let's make a blank keyframe, then on the frame's actions put-

1

This will set your variable start value to 1. Try a different number if you want to, but don't test the flash movie yet as it will not work at the moment.

Now make a new keyframe and put the stop function on it-

2

Now let's make a plus button and a minus button which will change the variables. If you need help with buttons, try our first
buttons tutorial.

3
Here's the minus button.

4
And the plus button.

Now let's make a text box but don't put anything in it. Now we need to change it from a static text field, to a dynamic one.
This dynamic field is what we are going to use to display our variable.

5

Now, as you can see, our Dynamic text field is clear and blends in to the background. This is not vital, but it's much easier to see.

6

To sort this we click the icon below-

7


Now, as you can see the field has a white background and an outline.


Now we need to set this dynamic text field to link up with our variable. We do this by setting the Var: field.

9

Now we can test this flash movie to see if it matches the variable we set at the start.

0


Now we can add code to our plus and minus buttons. Here they are-

11

There's the minus button.

12

And here's the plus button.

Now test the movie again. If it works, you could try setting different values, so you could
start at a different value or you could raise/lower the value by a different amount.


Here is my finished version-


Written by: Dazza_13
Website: http://www.frozenhaddock.co.uk/dazza13