What you want to do is go down to your local feedstore or garden store and get food quality diatomaceous earth. You'll want to put a little bit mixed in their feed to ensure they don't get worms and sprinkle it in their coop, especially in whatever you are using on the bottom - shavings, sand, etc. The DE will kill the larvae so the eggs cannot hatch. We find just the DE works for us. :D
Additionally, you may want to put out several small pieces of sponge soaked in natural vanilla scent or extract. Flies hate the scent and will avoid it. You can sometimes find natural (must be natural, not synthetic) vanilla car fresheners, those work great, too - just hang them in your coop. The fake vanilla doesn't seem to work as well, in our experience.
Simple homemade fly traps:
You can put an inch or more of apple cider vinegar (or fruity substance like orange juice or wine) & a squirt of dishwashing soap into a deep dish or jar, cover it with plastic wrap or lid, then poked some holes into it. It might have to be changed every couple of days.
If you like some action, you can also put 1/4 cup vinegar and a squirt of liquid dishwashing soap in a cup or jar and add water until the bubbles reach the top of the cup. Leave it on the counter and the flies are attracted to it and they get stuck in the bubbles.
Here's another fly trap you can use:
fill a quart jar with this mixture...
3 cups of water
¼ (one quarter) cup sugar
¼ (one quarter) cup white vinegar
Mix, punch holes in the lid, and set it where needed.
This method is used by folks who have to deal with safely keeping flys away every day. They have other fly remedies here:
A forum about homemade fly traps: click on the steps for illustrations:
You can also use a funnel over a jar that holds the fruity liquid:
With all those options, you'll find the right combination that works for your coop. Good luck!