Atoms and their light spectrum

In a hot flame, atoms can acquire so much energy that some electrons (sometimes but not always the valency electrons) become enormous moving, and they can not longer remain at their fixed position: they become in an 'exited state' in stead of staying in their 'ground state'.
For a moment they leave their own energy level and remove themselves a bit further from the atom nucleus.

Then you can have two options: