Graphics Programs Reference
In-Depth Information
18
19
20
21
22
23
// 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 4: Add objects to the scene
Before we concern ourselves with the exact placement of the objects, let's first add
them and use the existing coordinate data. We would like to use a loadMovie() meth-
od as in the last exercise, but we don't have any movie clips to load them into. We'll
create some additional empty movie clips as shown in line 45. Since we want to use
new objects, we will have to modify line 46 to specify the location of the new files.
42
43
44
45
46
47
48
// add objects to the scene in 3D space
for ( var i:Number = 1; i <= numberOfObjects; i++)
{
scene3D.createEmptyMovieClip("object"+i,i);
scene3D["object"+i].loadMovie("glasses/glass"+i+".swf");
thisObj = scene3D["object"+i];
placeObj();
Notice that the files being loaded are .swf files. This is one of four file formats that can
be used with a loadMovie command. The others are .jpg, .gif, and .png. You may be
wondering why this particular format was chosen. Because the objects to be loaded
have transparency due to a reflected image and no background was desired, the likely
format choices were .png and .swf. The .png format is more direct, while converting an
image into a .swf format involves an extra step.
There are two reasons why you might use .swf. The first reason is a reduction in file
size, which results in faster loading. The glass files typically ran about 88-120 KB as
.png files but were only 16-20 KB as .swf files, a pretty substantial savings in file size.
The other reason has to do with image quality as can be seen in Figure 7.22. The figure
shows part of a screen capture of two glasses that were zoomed in just at the point of
being too close to the viewer. The screen capture was then brought into Photoshop and
enlarged 200%. The glass on the left was loaded as a .png file, while the glass on the
right was loaded as a .swf file. At small to normal sizes, there is no significant differ-
 
Search WWH ::




Custom Search