Copy link to clipboard
Copied
My AS2 code (not working):
var btnX:Array=[gpat_btn0, gpat_btn1, gpat_btn2];
var attX:Array=["pat0","pat1","pat2"];
for(i=0;i<btnX.length;i++){
btnX.pvar=i;
btnX.onRelease = function(){
for(s=0;s<2;s++){
_root.movieC1.movieC2.C2.duplicateMovieClip(_root.movieC1.movieC2["clip"+s], _root.movieC1.movieC2.getNextHighestDepth());
}
_root.movieC1.movieC2.clip0.attachMovie(attX[this.pvar], attX[this.pvar], _root.movieC1.movieC2.C2.getNextHighestDepth());
_root.movieC1.movieC2.clip1.setMask(_root.movieC1.movieC2.clip0);
}
}
I want to create 2 duplicates of [ _root.movieC1.movieC2.C2 ] inside the same movieclip [ _root.movieC1.movieC2 ].
Attach a [ attX ] in one of the duplicates created.
Mask the above attached movieclip with the other duplicate.
again, you can't reparent a duplicated movieclip. your duplicate will have a parent that is the timeline that contains the duplicateMovieClip code.
so, you could use code in _root.movieC1.movieC2;
function duplicateC2():MovieClip{
return this.C2.duplicateMovieClip("c2dup",this.getNextHighestDepth());
}
Copy link to clipboard
Copied
you can create duplicates (using a string for the name) but you can't reparent using as2 with attachMovie or otherwise.
Copy link to clipboard
Copied
Thanks but I don't need to reparent the duplicate movieclips, I want to be able to duplicate the movieclips within the same original movieclip.
Eg:
Original movieclip is C2. resides in _root.movieC1.movieC2
Duplicates to be created are clip0 and clip1 inside _root.movieC1.movieC2
Any suggestions how I can achieve my requirement?
Copy link to clipboard
Copied
again, you can't reparent a duplicated movieclip. your duplicate will have a parent that is the timeline that contains the duplicateMovieClip code.
so, you could use code in _root.movieC1.movieC2;
function duplicateC2():MovieClip{
return this.C2.duplicateMovieClip("c2dup",this.getNextHighestDepth());
}
Copy link to clipboard
Copied
Great as always! thanks.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now