Control of flashing in fireflies