I agree with Geoff - fungus gnats, which are the tiny flies you're seeing, do not eat roots.
However, they love very damp, even soggy, soil - I wonder if your plants are simply rotting in the wet? Do all your pots have adequate drainage holes?
I agree that the gnats are likely to be attracted by the decomposing vegetation of your damaged plants. Have you tried going through the roots and looking for grubs? Sorry if this seems to be treating you like an idiot..
How long have these pansies and violas been in their pots?
I planted them this spring. The pots have drainage holes and aren't waterlogged. I have often changed the soil and haven't found grubs. Not all plants are affected and I often have healthy plants in the same pot. The sick plants just wilt, similar to a plant short of water ( which they aren't) and have roots missing. Maybe the grubs are very small and I haven't noticed them. Thanks for everyones help anyway
There are treatments for Fungus gnats (Sciarid flies). In large numbers the tiny soil living grubs could damage plant roots, but they have to be in large numbers. Also try putting a good deep layer of grit over the compost. This stops them from laying eggs.