According to TrafficTickets.com, it is not illegal to flash your headlights to warn oncoming traffic that a speed trap is ahead, or for any other reason. What IS illegal however, is an officer stopping a vehicle based upon the driver flashing his or her high beams.