Flies eat shit and don't just 'appear' out of thin air without reason.(unless they are fruit flies or similar)
Do you have pets?
Do you live in apartments?
Is there a pungent smell of shit in the room when the flies arrive?
If the answer is yes then call a professional to spray the place before summer and empty all bins regularly keeping food in air tight containers/bins. Check where the shores for the sewage are and make surethey are closed tight and that there are no sewage pipes running behind your PC monitor.
Then if the're still there, buy an ultra voilet Zzzzapper