AS3对象深拷贝

/**
	 * Deep clone object using [email protected] 's solution
	 */
	public static function baseClone(source:*):*
	{
		var typeName:String = getQualifiedClassName(source);
        var packageName:String = typeName.split("::")[1];
        var type:Class = Class(getDefinitionByName(typeName));

        registerClassAlias(packageName, type);
        
        var copier:ByteArray = new ByteArray();
        copier.writeObject(source);
        copier.position = 0;
        return copier.readObject();
	}

你可能感兴趣的:(clone,深拷贝,as3)