My S4 flashed while typing, playing games etc. It was so frustrating. I did a bit of research and found uninstalling Google Chrome is all it takes. It worked for me - it is like I have a new phone. I am so happy, I hope it works for you :)
- - - Updated - - -
My S4 flashed while typing...