You can also do this the other way around; if you have a Canon camera, you can load a custom firmware and then run a program that takes pictures only when it flashes. It would also be possible to take video clips starting at a flash, log flash times, etc.
http://chdk.wikia.com/wiki/UBASIC/Sc...ript_--_Fudgey