Flux-line entanglement as the mechanism of melting transition in high-temperature superconductors in a magnetic field