Duplicate Object in AS3
März 19th, 2009 • flash
Well this snippet does not copy the whole object, but you can create a new instance of that object.
function createNewInstance(obj : *) : * { var ClassReference:Class; ClassReference = getDefinitionByName( getQualifiedClassName(obj) ) as Class; return new ClassReference(); } // demo var tmp : MyType = new myType(); var tmp2 : MyType = createNewInstance(tmp);