Heya, im having some issues getting the duplicateMovieClip function work correctly. Im trying to create a drag and drop of a duplicate movie clip, so the clip stays in place but also drags as a duplicate clip.
The issue here is, if i use this code:
on (press) {
this.duplicateMovieClip(“circle1”, 1);
_root.circle1.startDrag();
}
It works perfectly. The movie duplicates and the duplicate drags.
My issue is, im trying to do this within its own movie clip, and it seems when I try using duplicatemovie clip inside of a movie clip the whole thing just breaks. Is there something im not doing right here or do duplicate clips just not work within other movie clips?
on (press) {
this.duplicateMovieClip("circle1", 1);
_root.circle1.startDrag();
}
shouldn’t it be:
on (press) {
this.duplicateMovieClip("circle1", 1);
this.circle1.startDrag();
//this or _root.movieClip.circle1.startDrag();
//The reason is that your circle is in a movieclip and
//not on the main timeline
}
if you’re duplicating “this” then to reference it, you would need
this._parent[“dup_name”]; since the duplicated clip exists (and always will) in the same scope of the clip duplicated. this exists in its _parent, so its duplication will too,