Phosphenes are brief spots of light brought on by eye movement (movement phosphenes) or sudden noises (sound phosphenes) and which last for less than a couple of seconds. Such phosphenes are often associated with optic neuritis and are caused by mechanical aggravation of a damaged or inflamed optic nerve. They are usually more obvious in low light conditions.
Flashes of light can also be associated with other medical problems in addition to optic neuritis including a detached retina, compressive optic neuropathy and stroke. They can originate from retinal cells as well as from the optic nerve and under such circumstances may prelude a detached retina. They can also be induced by very strong magnetic fields.Those stars and colours you see when you rub your eyes are called phosphenes.
In optic neuritis, movement phosphenes are usually brought on by side-to-side movement of the eye. In origin, they resemble L'Hermitte's symptom (electrical shock or buzzing sensations brought on by lowering the head towards the chest). Both symptoms are caused by mechanical aggravation of injured nerves. Both sensations tail off with repeated movement but will reappear after several second's or minute's rest.
Movement phosphenes can sometimes be induced weeks or months after vision has all but completely recovered but it is rare for them to continue for a year after the initial attack of optic neuritis.