Here is how to dynamically create a movie clip in ActionScript 3 using the MovieClip class
First you have to declare the movie clip:
var myMC:MovieCLip = new MovieClip();
Than you have to add it to the stage using addChild:
addChild(myMC);
You can create MovieClips, Sprites, and Objects by calling the word new
Here is an example of the AS2 syntax:
var myMC:MovieClip = _root.createEmptyMovieClip("mc1", _root.getNextHighestDepth());
But for AS3, remember that after declaring your MovieClip it remains in memory and won’t be visible on stage until you call addChild(YOUR_MOVIE_CLIP_NAME)
Here is the AS3 example with property settings:
var myMC:MovieClip = new MovieClip(); myMC.x = 50; myMC.y = 50; myMC.name = "mc1"; addChild(myMC);


(18 votes, average: 4.33 out of 5)
how about placing a single movie clip on 2 movie clips let’s say I have a movie clip named imgContainer, and it has a set of images in it.
for(i=0;i < 2;i++){
var myMC:MovieClip = new MovieClip();
myMC.x = 50;
myMC.y = 50;
myMC.name = "mc_" + i;
myMC.addChild(imgContainer);
}
addChild(myMC);
Basically, I want to append 2 image containers in this scenario, but it won't just happen. Not sure why and how to do it in AS3. Thanks!
Did you first declare “imgContainer” before your loop.
var imgContainer:MovieClip = new MovieClipFromLibrary();
It seems really unintuitive to position the clip before adding it.