how do i create a duplicate movie clip in action script 3
Dear Experts!!
I am wondering how to create a new movie clip instance in action script 3, that is a copy of another already existing instance.
Background:
I am building an interactive map. when a region of the map is clicked on I want to make this region appear larger (which successfully works already). The problem is that there is a space left behind in the original map where the region that was clicked on used to be. (Each region is a separate movie clip.)
I would like to make a temporary copy of the original region, and then only move and enlarge the copy, leaving the original behind so as to avoid a blank spot appearing.
I tried making a variable to hold the temporary copy, and assign the value of the original to it before moving one of them, but unfortunately it appears that the assignment operation results in merely a pointer being placed to the original, and not a real copy of the original movie clip.
I would like to avoid having to make a new class in a separate library to create a new instance of the original. Is there a way to accomplish this simply?
Thank you
function doRegionClick(_mc:MovieClip) { var temporaryMc:MovieClip = new MovieClip(); //tried var temporaryMc:MovieClip = new _mc(); but not a funct temporaryMc = _mc; //this is where the problem occurs: temporaryMc just points where _mc points to addChildAt(temporaryMc, numChildren - 1); //doesn't appear to work because a gap appears in map // moves temporaryMc to middle of window animateObject(temporaryMc, (stage.width / 2) - _mc.width, (stage.height / 2) - _mc.height, 300, 400);}