What is the Difference
Trolling is different from flaming in the difference of who the person doing the trolling/flaming is targeting. What that means is with trolling no singular person is being targeted but rather a person making a offensive comment and putting out there to cause chaos of people arguing. Flaming however is when a certain person is being attacked with an offensive comment.
How to avoid
1. Easiest way is to just avoid places where these things would happen ex. internet forums, youtube comment sections.
2. Do not engage people who are making rude comments on these websites if you are on them
3. Be able to identify trolling when you see it because if you can do that you should be able to avoid flaming as well