Fruit flies can be frustrating.
Have you figured out where they are coming from? Once a structure is infested with fruit flies, all potential breeding areas must be located and eliminated.
Keep fruit in the refrigerator, and wipe up any juice spills or rotting remains with soap and water. Be sure to check overripe bananas and bags of potatoes or onions for soft/rotting ones and eliminate.
Finding the breeding site takes some detective work. Potential sites include wet sponges, mops or towels, drip pans under the refrigerator, garbage disposals, and recycling bins. All that is needed for development is a film of fermenting liquid.
You can make or buy a simple trap that attracts and kills the ones you can't seem to smash by putting a small amount of vinegar with a drop of soap in a dish or bottle.
Here is our page on Fruit flies: http://extension.umd.edu/hgic/fruit-flies