With a 2AA type flashlight, you can use Twofish Lockblocks to mount them onto your handlebar. They do a pretty good job holding position with a light this size. I've made it work with a 2C type light, but it's more likely to shift due to weight.
Just be sure to mount the light close to the center of gravity, and snug the velcro straps tight.