PDA

View Full Version : Simple Calculator using Adobe Flash CS3


Oj_RuLeS
05-06-08, 10:45 AM
Okay, lets start but before starting I would like to inform that I am using Adobe Flash CS3 Pro (Flash 9.0) and ActionScript 2.0 if you are a very beginner for Flash you should at least know tools like Text etc.

Lets start :)

1. Create a new document using ActionScript 2.0 and fill the Background with the color of your like.
2. Now select "Text Tool" and set the text type to "Input" and draw a box as shown in the screenshot below

http://i170.photobucket.com/albums/u278/omkarjere/Tutorialistic/CL_01.jpg

3. Once the box appears what we have to duplicate it twice (Alt + Mouse Drag to duplicate) now arrange them according to your will and just label them as shown below

http://i170.photobucket.com/albums/u278/omkarjere/Tutorialistic/CL_02.jpg

4. I have just duplicated the first box twice and added a Text label to them so we can understand things easily :)

Note: Make sure the last (3rd) Box's text type is Dynamic otherwise you'll be able to edit the final answer to do this select the last box and click where it is written Input Text and select Dynamic test from the list.

5. Now we have to give the boxes variable names to do this see the screenshot below

http://i170.photobucket.com/albums/u278/omkarjere/Tutorialistic/CL_03.jpg

6. After you have give the variable names to the boxes we need to create signs of +,-,*,/. to do this use the "Text" tool (Text Type = Static) after you have typed the operators (+,- etc) we need to convert them to buttons to do this select each of them individually and press F8 now select Button and Click OK as shown below

http://i170.photobucket.com/albums/u278/omkarjere/Tutorialistic/CL_04.jpg

7. Once you have converted all the operators (+,- etc) to buttons select the "+" button and press F9 to see the ActionScript window now type in as below

on (press) {
rs= Number(i1) +Number(i2);
}

Now do the same with the rest of the buttons just remember to change the signs on different number for e.g for + button in the line rs=Number(i1) +Number(i2); in here just change - for minus button, * for multiplication & / for divide button and you're done ::cool: Test it by pressing Ctrl+Enter and type digits in Input 1 & Input 2 box and click on any of the operator (+, - etc) to get the result in the 3rd Box.

Note: In the Script coded above rs,i1,i2 are the variable names which were given to the boxes earlier. modify them in your side if you have given different names to your boxes.

Enjoy!!!!!

I am attaching my file below

Hitterman
05-06-08, 02:43 PM
Great. Is this for Newbies?

shalin_hitter
07-06-08, 01:42 PM
Waitng for it.........

Oj_RuLeS
07-06-08, 05:50 PM
Posted :)

Hitterman
07-06-08, 08:34 PM
I wasn't knowing that you are too good. I thought only Shreyas can do these type of things:). rps for you. Great to have you on our site;)

shalin_hitter
09-06-08, 02:24 PM
iT is 2good

alakazam
27-06-08, 11:33 AM
fantastic tut i will try

Hitterman
27-06-08, 01:46 PM
It has been proven that Omi is the most talented guy here:).

xiaozaiz
14-12-08, 06:14 PM
Fantastic~!
Keep up the good work