Plastic bags filled with water repel flies because the liquid within them refracts light, which in turn confuses the flies. Flies, like many insects, have complex eyes that are vital to their navigation. Their eyes are sensitive to changes in sounds and light, and the presence of refractive light emitted from water-filled bags prevents flies from landing.
Flies base most of their movements on light. They rely on a steady, focused and constant source of light to help them navigate through homes and other places. Flies are deterred by strong lights, such as those refracted from water-filled plastic bags. Instead of landing on the bags, flies move elsewhere to locations that are less light intensive.