Go get some SWAT. Also, if you don't like having dogs with some hot pink paint, fly spray works too, just not as well and requires constant spritzing to really keep the flys gone.
The SWAT works best. It's a thick, hot pink paste that you can put where the flys congregate and it will stay on for several days to a week. It's sold for horses and livestock, but you really can use it on dogs. The only trick is your really don't want them eating it, but since the issue is on the ears, it shouldn't be an issue.