The ultraviolet-to-near-infrared spectral flux distribution of four BL Lacertae