Graphics Programs Reference
In-Depth Information
Step 1: Getting started
As a first step, let's change the background into a more appropriate image. Go to the
Stage and select the background. In the Properties window, choose the Swap option.
The Swap Symbol dialog box will appear. Select bg3 and click OK. The new background
will appear on the Stage.
Step 2: Create the objects for the circular motion
At this point we no longer need the green ball, so select it and delete it from the Stage.
If you wish, you can also delete it from the Library. We no longer need it because we
are going to create empty movie clips on the fly and load our objects into them. This
can be done by changing the two lines of code shown below.
22
23
24
25
26
27
// create the objects for the circular motion
for (var i:Number = 0; i < numberOfObjects; i++)
{
this.createEmptyMovieClip("object"+i, i);
this["object"+i].loadMovie("vases/vase"+(i+1)+".png");
}
Since the number of objects is set to 8 and we are inside of a for loop, line 25 cre-
ates empty movie clips named "object0" at depth 0, "object1" at depth 1, ...,
and "object7" at depth 7. In line 26, .png files are loaded from a vases folder into
the empty movie clips in the following way: "vase1.png" goes into clip "object0" ,
"vase2.png" goes into clip "object1" , and so forth until eight vases have been loaded.
Save your movie as xzRotation4.fla and test it. You should have eight different
objects rotating around in a manner similar to that of Figure 6.18. As the figure shows,
there is some good news and some bad news. The good news is that it was a very
quick and easy substitution to get the bitmap images loaded and rotating. Moreover,
if we look at the size of the .swf file, we see that it is only 4 KB, which is good news
indeed.
The bad news is that the objects aren't where we expected them to be and that they
appear to be a little squished together. The latter problem is quickly solved by increas-
ing the radius, which we will do shortly. Moving the circle of objects to the left and up
somewhat is also easy to do by changing xc and yc , the coordinates of the center of
the path.
 
Search WWH ::




Custom Search