Click here for part 5
Now with the calculator design completed, we are ready to move on and start coding. The variables first!
Click here for the Final, Completed, Flash CS4 Source Code
HERE IS THE SOURCE CODE!
// solutions at say-web dot com
// FREE to USE, COPY and DISTRIBUTE
// Calculator Variables
/* This array handles the buttons
instance names */
var numbers:Array= [ num0_btn, num1_btn, num2_btn, num3_btn, num4_btn, num5_btn, num6_btn, num7_btn, num8_btn, num9_btn];
/* This array will handle the operation buttons.
the order is not important, the spelling must be
correct */
var operators :Array = [add_btn, subtract_btn, multiply_btn, divide_btn, equal_btn];
/* This variable handles the operation itself
(NOT the button) */
var op:String;
/* this will handle the first value
and the second */
var num1:Number;
var num2:Number;






2 Responses to “ActionScript Calculator Part 4: Declaring Variables and Button Array”
Trackbacks/Pingbacks