if you flashed it, meaning you wiped and reloaded a whole new firmware, and the problem still persists, then it isn't related to the firmware, something is wrong with the hardware portion of the phone. However, if its anything like a computer- a camera driver maybe corrupted somehow. Are you sure you flashed absolutely everything? maybe patches are affecting it?