I think they're more attracted to the shadows cast by the flash, thinking it's a moving prey than be bothered by the flash itself. Seen this happen with my tree frog