Are you experiencing small flies at home? All of a sudden it seems like you are being invaded by gnats? The first thing you have to determine is what kind of flies they are. For a home owner it is best to do this by process of elimination. You can rule one kind of fly out by looking closely at the eyes, if they are red then they could be fruit flies, problem is not all fruit flies have red eyes. Look for any fruit, fruit juice, apple skin peels, etc that may have fallen or spilled. Look in your trash can for spills that may have leaked in between the trash bag and the can, or look on top of the trash can lid for splashes. Fruit flies can breed in the littlest of spills or pieces of fruit. The other kind of flies you could have would be drain flies. Unfortunately they can be more difficult to get rid of. They often breed from the slime that forms on the inside walls of your drain pipes. They can come from the kitchen or bathroom drains. I suggest getting some double sided tape and lining some foam drinking cups with them, put them over all your drains before bed and then look at them in the morning for any that are caught. If you caught some then that is your problem drain. Enzymes for the drain can help to get rid of the slime or a good still drain brush. If you found nothing then they could be coming from a broken soil pipe in the basement. A plumber can research this for you with a camera scope. Hope that this is not your source as it is a very expensive fix. The last possible source of your small flies could be soggy plants. Fungus gnats can come from your indoor plants that you may be over watering. Use the same double sided tape or glue trap and place near or inside the dirt of the plant.
All of the flies above can be fixed by repairing or getting rid of the source. Spraying is only a very temporary fix of a fix at all. Cleaning up the source would be your absolute best bet. The drain enzymes mentioned above can be found online or possibly at your home store. DF 5000, drain gel, and nulliFly are good options for this fix.