I've done a bit of tinkering around with this problem too. Here's one way to do it (though there are probably more, way prettier ways to do it. for example check out madsters "Dark Asteroids"
game):Take a look at this cap.
Arrow keys move, mouse points flashlight.
Basically for my solution you need at least two layers. The top one needs to have the Multiply effect on it. Then create a white gradient in some sort of graphics program like the GIMP
in the shape that you want your flashlight to have. In the cap, I've made the gradient larger around the player so you can see what you're doing. The layer beneath the top one should have your game elements like your player, etc.
You can stop there, but in the cap, you'll see that i've added a light object and some shadow caster objects. Take careful note how the layers are set up and what is in them.
Hope this helps.