1. Create 2 input boxes, with the variable names "x" and "y" (X in the first one and Y in the second)
2. Put them next to each other, a little above the centre of the stage.
3. Create a button that says "Multiply" in it somewhere, and place that in the centre of the stage. This is the button we will be adding code to.
4. Make a dynamic text box and place it under the multiply button, give it the variable name "ans".
5. Now click on the button we created earlier.
6. Open the actions panel and type this code:
on(release){
var x;
var y;
var multi1 = x * y;
var ans = multi1;
}
What the code does:
on(release){ - tells flash to run a new fuction (The code inside the {}'s) when the button is pressed.
var x; - is the first input box, this detects what has been entered into the box.
var y; - is the second, it does the same thing basicaly.
var multi1 = x * y; - is telling flash that multi1 should multiply the X value by the Y value.
var ans = multi1; - is displaying the sum of x * y in the dynamic text box "ans".
} states the end of a function.
7. Press ctrl + enter to test what you have made.
8. Just so I can end on an equal number :P
Feel free to edit the code and appearance of the button. If you don't understand what anything should look like, check the swf or fla.
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section Submit your Tutorial at Click Here