Graphics Programs Reference
In-Depth Information
9
10
11
12
13
14
15
// create the picture plane: a movie clip named scene3D
// and position it in the center of the Stage
createEmptyMovieClip("scene3D", 0)
scene3D._x = Stage.width/2;
scene3D._y = Stage.height/2;
Step 3: Define the coordinate data
We are going to provide the actual coordinates for each of the placeholders to posi-
tion them in 3D space. For our needs, it is convenient to put the coordinates into three
arrays named xdata , ydata , and zdata to store the x-, y-, and z-values for the objects.
The placeholders suggest what we are after, namely three rows deep with each row
containing five images. The vertical value of all objects will be the same. Add the lines
below to the script after numberOfObjects . Each of the arrays could go on a single line,
but we have written them with multiple lines to indicate the 3D layout of the objects.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// define the coordinate arrays
xdata = []; ydata = []; zdata = [];
xdata = [ -1000, -500, 0, 500, 1000,
-1000, -500, 0, 500, 1000,
-1000, -500, 0, 500, 1000 ]
ydata = [ 100, 100, 100, 100, 100,
100, 100, 100, 100, 100,
100, 100, 100, 100, 100 ]
zdata = [ 600, 601, 602, 603, 604,
900, 901, 902, 903, 904,
1200, 1201, 1202, 1203, 1204 ]
The x-coordinate data is based on the fact that the images to be used are each about
450 pixels wide so that placing them 500 pixels apart guarantees that there will be no
overlapping of images. The z-coordinate data places each row of objects essentially 300
pixels apart. Notice, however, that each object has a different z-value. This is necessary
because we will later employ the swapDepths() function to sort the objects according
to their z-coordinates. Flash requires that each object has its own distinct depth value,
 
Search WWH ::




Custom Search