Graphics Programs Reference
In-Depth Information
49
50
51
52
53
54
55
// create the motion along the path
this.onEnterFrame = function()
{
angle += 5;
placeObj(object_mc);
displayObj(object_mc);
}
Step 6: Add some user interaction
Let's add some simple user interaction as a final step. We'll set the circular motion to be
clockwise if the cursor is on the left side of the Stage and counterclockwise if the cursor
is on the right side of the Stage. Add the lines shown below, and you're done.
49
50
51
52
53
54
55
56
57
// create the motion along the path
this.onEnterFrame = function()
{
// update the angle increment based on _xmouse
if (_xmouse > xo ) {angle += 4; }
else angle -= 4;
placeObj(object_mc);
displayObj(object_mc);
}
Save your file as 6_4_xzRotation1_DONE.fla and test the movie. Select the circle
and set its alpha to 0 in the Properties window. Test your movie again. Even on a flat
background, there is a good sense of movement in a 3D space. Notice how simple the
change in size due to perspective becomes. There is no complicated expression like
the one we had when simulating the 3D movement in a 2D world.
Rotating Multiple Objects
Let's extend the above to include multiple objects. It's really a simple task since we can
use the script in the example above and add to it appropriate parts of the 2D rotation
script from 5_3_dolphinSwim1.fla in Chapter 5. Open the file 6_5_xzRotation2.fla
in the Chapter 6 folder. Test the movie so that you can see what the result is.
 
Search WWH ::




Custom Search