|Now that we have programmed the envelope flap in our FlashR animation to appear fully open above the envelope when the stamp button is clicked, we need to refine the animation to make it appear that the flap is slowly opening. We will do this by controlling two properties of the flap. Remember, the newFlap object is a variable which references the FlapAni movie clip in the Library. We use this var to make the flap appear on the stage. |
As a quick review, in the last tutorial, we programmed a function called openFlap to add a newFlap object to the Display List. We did this with the addChild code. We also set the initial position for the newFlap.x and newFlap.y properties. This placed the bottom of the flap at the top edge of the envelope. As mentioned before, your values for the x and y position on the stage may vary depending on the size and location of your envelope.
The first thing that we need to do is to experiment to find a newFlap.y value that will place the flap below the top edge of the envelope, and therefore out of sight at the beginning of the animation. In fact, we want the point of the triangular flap to be just below the top edge of the envelope. While you are experimenting, it may be easier to move the flap 100 pixels to the right by setting the newFlap.x to 300 (an addition of 100). This will make the flap partially visible on the right side of the envelope. After experimenting, I found that a newFlap.y value of 200 was what I needed. This is our new initial position for the flap. Don't forget to put the newFlap.x value back to the original value before moving on to the next step.
Join us in the Flash forum.