In dynamic optical networking scenarios, it is desirable that the optical transmitter chooses the most suitable modulation format in order to achieve optimal transmission performance. Owing to the ability of switching among different modulation formats, flexible optical transmitters based on reconfigurable optical devices are becoming a key component for the implementation of future flexible optical networks. In this paper, we experimentally demonstrate a flexible 8-ary transmitter to achieve adaptive switching between 8-ary phase-shift keying (8PSK) and circular 8-ary quadrature-amplitude modulation (8QAM) through reconfiguration of two cascaded in-phase/quadrature (IQ) modulators with different driving signals and biasing conditions. An arbitrary binary quadrature-amplitude modulation (2QAM) with constant or non-constant amplitude is proposed and experimentally demonstrated using an IQ modulator. Then, optical 8PSK or 8QAM modulation formats are successfully synthesized when a standard squared QPSK modulator is cascaded with a constant-amplitude or non-constant-amplitude 2QAM, respectively.