Graphics Programs Reference
In-Depth Information
16
17
18
19
20
21
22
23
24
25
26
// set the number of objects to be created
var numberOfObjects:Number = 15;
// add objects to the scene in 3D space
for (var i:Number = 0; i < numberOfObjects; i++)
{
scene3D.attachMovie("dolphin","object"+i,i);
thisObj = scene3D["object"+i];
placeObj();
}
Notice that we are using the attachMovie method rather than the duplicateMovie
method we have been using. Either can be used, but attachMovie doesn't require that
the object be on the Stage or in the Timeline initially. It is critical, however, that the
movie clip to be attached has the proper linkage established.
To set the linkage, select the movie clip in the Library window and then click on the
Properties icon at the bottom of the window. When the Symbol Properties window
opens, select the Export for ActionScript option under Linkage. The name of the movie
clip will appear in the Identifier box. You can use either the name of the movie clip or
another name if you wish. The important thing to remember is that the identifier name
is the one that you reference when you attach a movie. Click the OK button when done.
Figure 7.4 Setting the linkage of a movie clip
Search WWH ::




Custom Search