either red giant's unmult or make your own in AE.
First pre-compose your lens flare on the black solid layer and move all attributes to the new pre-comp.
Then apply the Set Matte effect to the pre-comp in your main comp and change the "Use For Matte" property to luminance or lightness.
Then change the pre-comp's blend mode to "Luminescent Premul."
Thank you for the input Chris, very nice.
If I understand your post correctly, you are using standard layer transform tools to position and scale your flare. Using Unmult or other forms of transparency won't resolve the problem you're having. Plus, you are losing the true beauty of lens flares, where seperate elements of the flare change at different rates as its position changes. Your current flare's seperate elements will remain blandly static if you are just moving the whole layer.
You need to move the flare by moving its point of origin within the flare plugin, rather than from the layer. you can link the flares point of origin with expressions. If you are working entirely in 2D this will be very straightforward. If you are working with 3D layers it may be a bit more complicated.
If if you need an explanation post back and I'll write a better explanation when I'm not on a mobile device.
Wow Andrew...This is extremely nice of you to offer this information....
This kind of professional response is what Adobe prides themselves in having this forum for...
This particular question has been being asked for the last six years and not one of the questions I have found has been marked with the correct answer. I am positive a plethora of others would love to know the proper work flow to accomplish this task. My AE 2015 is the stock version with no other plugins.
I would find myself in your debt in receiving a work flow to accomplish this task.
P.S. I have not had the time to follow chris's path yet.
Thank you for your time and I would love to see the 2D version and the 3D version to resolve this task if you have the time.
I'm guessing you're fairly new to After Effects so will keep this fairly simple. As you get better you'll find all sorts of complexities to make things easier and better to work with. Take Rick's advice above and use some of the Getting Started resources available.
In the image above, slide A and B are what I assume you are doing at the moment. A solid with Lens Flare applied has been parented to another layer, making the entire solid with flare move in sync with the layer (in my example, a small yellow solid.) The problem is that the flare falls over the bounds of the solid, so the edge of the flare becomes cut off when the solid isn't filling the frame.
In example C and D, I have used a simple pick whip expression to link the Flare Centre parameter of the flare plugin to the position of the Yellow Solid. Doing it this way has two advantages: the solid never moves, so the flare never gets cut off at the edges; and the flare looks more like a real life lens flare, because the different elements of the flare move and change according to the position of the light source, defined by the Flare Centre.
I've posted a project file with both these examples, and with a simple 3D version as well. The standard After Effects Lens Flare plugin is very simple, without a scale parameter, so it doesn't really work too well in 3D. There are a number of more advanced third party Lens Flare plugins, the most common being Video Copilot's Optical Lens Flare, but these come at cost of course.
Andrew, your kindness to the beginner, I was amazed.
Mr.Mrwipg. Everyone starting as your case.
Thank you so much again. You were absolutely correct!
My issue was I had pick whipped everything to the flare instead of one of the solids.
My gratitude to you is high.