So, last time we looked at how to run an objects constructor to create a duplicate - which is what Adobe recommends as a replacement for duplicateMovieClip.
The problem is that even tho this solves a majority of the situations it does not let us copy an Objects state (such as a Display Objects position, graphics property or the content of an Array).
Flash copies primitive data types such as String and Int when they are assigned to a variable:
1 | var… |
Copying a Movie Clip in ActionScript 3. Can’t be done. Right? Wrong.
Well, duplicateMovieClip is certainly gone, but there are still ways of making copies - running an objects constructor for example.
The basic way of doing this (which you no doubt know) is running the constructor of an object directly:
1 2 3 4 5 | private var _circle = new customCircleClass // "copy" private var _circle2 = new customCircleClass |
This, however, requires you to know the name of the constructor you are running. In many cases…