Graphics Programs Reference
In-Depth Information
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// take the average of max and min to find the center
xc = (xmax + xmin)/2;
yc = (ymax + ymin)/2;
zc = (zmax + zmin)/2;
// check if the object is too close
if (d + zmin < tooClose )
{ note_mc._visible = true;
scene3D._visible = false;
}
else
{ note_mc._visible = false;
scene3D._visible = true;
}
}
Save and test your movie. Make sure that the alert note and scene turn on and off
as they should. This completes the exercise.
Exercise 9.2: Extruded Objects with Lines
As a transition from planar objects to fully three-dimensional ones, let's look at line
drawings of simple extruded objects. An extruded object is basically a 2D shape that
extends along the object's z-axis to add thickness. In this exercise, we'll use the results
of the previous exercise to create a simple extrusion program. To view the finished
results of this exercise, open 9_2_extrusionDONE.swf in the Chapter 9 folder. You
should be able to get results similar to Figure 9.11.
Step 1: Getting started
We'll begin where we left off, so open 9_2_extrusion.fla in the Chapter 9 folder.
This file contains the script that we just discussed in Exercise 9.1. Let's load in a data
file that we can use. Change line 2 to that shown here. We are going to make an
1
2
3
// include the object data
#include "extrudeDataV.as"
 
Search WWH ::




Custom Search