Like a moth into the flame - phototaxis is commonly thought of as the iconic example of hard-wired input-output relationships in insect brains. Perhaps therefore, the century-old discovery of flexibility in Drosophila phototaxis has received little attention. Here we report that across several different behavioural tests, light/dark preference is dependent on the flies' ability to fly. If we temporarily compromise flying ability, phototaxis reverses concomitantly. Neuronal activity in circuits expressing dopamine and octopamine, respectively, plays a differential role in this case of behavioral flexibility. We conclude that flies constantly monitor their ability to fly, and that flying ability exerts a fundamental effect on action selection in Drosophila. This work suggests that even behaviours which appear simple and hard-wired comprise a value-driven decision-making stage, negotiating external stimuli with the animal's internal state, before an action is selected.