[Part 7 of 8]
At some point the counter gets to zero, however, so the creation of the imSmall image object has to watch out for that. The easiest solution was to put in a test to avoid a divide-by-zero error:
if stepNumber <> 0 then imSmall = image(w/(stepNumber*4), h/(stepNumber*4), the colorDepth) else imSmall = image(w, h, the colorDepth) end if
If the counter is zero, then a full size image object is created and the returned image is a copy of the original with no modifications--just what the final image should be.
The next step is to break apart the outgoing and ingoing routines so they can each be used separately. That will allow you to drop the outgoing behavior on one sprite and the incoming behavior on a subsequent sprite, providing the transition between them. All of the work using imaging Lingo has been done, so these next modifications to the movie are to create real behaviors, rather than just handlers acting like behaviors. This means using properties rather than global variables, and adding the ability for the programmer to set values when the behavior is dropped on a sprite. Here's the Director file for the final version:
Getting weird characters when you try to download? Right-Click (Win) or Ctrl-Click (Mac) and use SAVE THIS LINK AS... and select SOURCE in the dialogue box
The conversion of the script to two behaviors is interesting, especially if you have never used some of the behavior Lingo such as getPropertyDescriptionList. Check out the article that follows this one for comments on implementing the behaviors on the Demystified web site at http://www.demystified.com.