Sensory systems provide abundant information about the environment surrounding an animal, but only a small fraction of that information is relevant for any given task. One example of this requirement for context-dependent filtering of a sensory stream is the role that optic flow plays in guiding locomotion. Flying animals, which do not have access to a direct measure of ground speed, rely on optic flow to regulate their forward velocity. This observation suggests that progressive optic flow, the pattern of front-to-back motion on the retina created by forward motion, should be especially salient to an animal while it is in flight, but less important while it is standing still. We recorded the activity of cells in the central complex of Drosophila melanogaster during quiescence and tethered flight using both calcium imaging and whole cell patch-clamp techniques. We observed a genetically identified set of neurons in the fan-shaped body that are unresponsive to visual motion while the animal is quiescent. During flight their baseline activity increases, and they respond to front-to-back motion with changes relative to this baseline. The results provide an example of how nervous systems selectively respond to complex sensory stimuli depending on the current behavioral state of the animal.