We propose for the first time (to the best of our knowledge) and demonstrate a tunable multiple optical code (OC) converter for flexible networks that allows dynamic code (bandwidth) allocation in a way similar to a tunable laser. With respect to other OC converters, this scheme can convert both specific and multiple OCs by changing only the amplifier gain. The proposed scheme uses cross-phase modulation (XPM) and two linear-slope control pulse streams generated by fiber Bragg gratings (FBGs) in the C-band. The OC converter can be used to avoid collisions in optical packet switching networks, and we analyze the corresponding packet loss probability performance.