Using Objects in ActionScript > Adding parameters to dynamically created movie clips

 

Adding parameters to dynamically created movie clips

When you create or duplicate a movie dynamically using the MovieClip.attachMovie and MovieClip.duplicateMovie methods, you can populate the movie clip with parameters from another object. The initObject parameter of the attachMovie and duplicateMove methods allows dynamically created movie clips to receive clip parameters. The initObject parameter is optional.

For more information, see MovieClip.attachMovie and MovieClip.duplicateMovieClip in the ActionScript Dictionary.

 
To populate a dynamically created movie clip with parameters from a specified object:

Use the following syntax with the attachMovie method:

myMovieClip.attachMovie(idName, newName, depth [, initObject] )

Use the following syntax with the duplicateMovie method:

myMovieClip.duplicateMovie(idName, newName, depth [, initObject])

The parameter initObject specifies the name of the object whose parameters you want to use to populate the dynamically created movie clip.