Wednesday, September 28, 2005

% Modulo Operator by Mario Klingemann

First I would like to welcome Mario Klingemann to IFBIN as a author/partner. Mario completed this excellent example using the % Modulo operator. The example calculates an animations horizontal position using the modulo operator.



The modulo operator is essential to understand and invaluable in problem solving for animated motion and graphical programming. Mathematically speaking, the modulo operator returns the remainder of a division operation. So for example 22 % 5 will return 2 because if you divide 22 by 5 the 5 will fit 4 times into 22 ( 5 * 4 = 20 ) and leave a rest of 2. This operator provides a handy shortcut where you need to know the remainder. In Mario's example the _x position of the animated red dot is based on the modulo calculation of the range between the two dragable barriers.

The example also provides some trace logic for understanding Modulo in detail. This example is part of the larger basic curriculum at IFBIN. We are providing coverage of every default player method, property, operator, and constant.

This example is available with full source and documentation within Flash® by Example.

More to come.

Ted :)

0 Comments:

Post a Comment

<< Home