Light flashes and mucus formation in the eyes are not related to each other. Flashes of light is a symptom of involvement of the posterior segment of the eye mainly involving the vitreous and retina
in the posterior part of the eye. This can be seen in cases of liquifecation of vitreous which usually occurs by 40-50 years of age. Usually the condition is self limiting and may not require treatment. However requires ocular examination by a ophthalmologist or preferably by retinal specialist.
Mucus formation is usually a feature of chronic conjunctivitis
which requires treatment by antibiotic eye drops as per the advice from your eye doctor.