On the fly means doing something without stopping and with little or no preparation. When circumstances abruptly change and you have to deal with them, that’s doing things on the fly.