|
|
Search Tutorials
EXPLANATION
Let me tell you what numbers these systems have and the procedure I followed to convert a certain number from one system to another.
The procedure for converting is approximately common for all systems. I'll explain the simplest conversion (decimal to binary). If the user types 82 as a decimal number, I try to find all the numbers that are less than to this number such that these numbers are powers of 2. That is: I take 64 and divide it by 82. I notice that there is one 64 in 82. The result is 1 (first digit in the binary system). I also compute the remainder, which is 18. Then I take 32 and divide it by 18 and notice that there is no 32 in 18 and the division yields zero. So, the first two digits in the binary number are 1 and 0. I proceed in the same manner until I get the binary number: 1010010. Note: To convert to binary, we take powers of 2 and apply the same method. To convert to octal, we take powers of 8 and apply the same method. To convert to hexadecimal, we take powers of 16 and apply the same method.
The FLA file is available for download. Well, all we need is a single layer made up of 5 keyframes in the main timeline. The first keyframe contains the definitions of all the functions used. I used 6 functions that do the following:
We'll go over the scripts of all these functions line by line to understand how they execute. I used 4 radiobuttons from Common Libraries/Smart Clips that let the user chooses among the four number systems. For instance, if he chooses Decimal number system, then the second keyframe will be executed. When the user then types in the decimal number and presses the convert button, the corresponding number is converted to binary, octal, and hexadecimal using 3 dynamic variables that exist through out the last 4 frames in the main timeline. The dynamic variables are (output1, output2, and output3).
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|