Suppose, for example, that we have three buttons in three different
movie clips, all with the same purpose. Instead of triplicating our
code, we can put one copy in a function on the main timeline and
invoke it from each button as needed. This saves time, reduces the
potential for errors, and makes it easy to update the behavior of all
three buttons at once. Because the code is centralized, testing is
more reliable and troubleshooting much easier. If one button works
and another doesn't, chances are that the problem is in the
second button's function invocation and not in your centralized
behavior.
 |  |  |
9.11. Functions as Objects |  | 9.13. The Multiple-Choice Quiz Revisited |