I have some object, which extends movie clip:
public class MyClass extends MovieClip { ... }
Now, I want to put two of this in the stage:
var obj:MyClass = new MyClass();
addChild(obj);
That would put one, but the other I want it to be exactly the same as the first, so I just need to add a "reference" of obj
to the stage, along with obj
itself.
In the end, I want two objects of type MyClass doing the same thing in the stage. If I try to simply do:
var obj2 = obj;
addChild(obj2);
only obj2 will appear in the stage.
How could I achieve that with references? (in order to save memory and CPU time (it is really important))
Thanks in advance!
There isn't really a good way to do what you want to do. From what I'm reading, you want two objects on the stage....but you want them to do the same thing on the stage, so you actually want only one object.
By design, an object on the display list only has one location. If you have more than one location at the same time, you'll need two objects. There is, however, another way to do this that involves blitting, but you'd have to put the framework in place....but, you can use one object and copy them to multiple places on your stage. If this is the way you want to go, there's a tutorial here.
Good luck.