I was having a similar screen flickering problem with my HP Envy for a year or so and finally fixed it yesterday. My problem was that the battery had gotten old and lost most of its capacity. The solution was to replace the battery, and my screen has not flickered yet on battery today. A description of my symptoms and diagnosis is below in case it helps anyone else.
My laptop worked normally when connected to AC power. The screen would only flicker after being on battery for an hour with somewhere less than 50% charge remaining, and more recently I could only go 15 minutes. I could still dimly see colors on the screen, it was just the backlight flickering. It would get worse when I did something resource intensive like opening a program, or loading a new webpage over wifi. I tried lots of "fixes" offered in these forums like updating windows, updating drivers, and changing power settings, but nothing worked if not just to delay flickering a few more minutes. I finally suspected a bad battery when I worked through it and windows shut down with 50% charge left. I googled how to generate a battery report (steps on that below*), and discovered my full charge capacity was only 40-50% of the design capacity. I bought a new battery on ebay and replaced it carefully by myself. The battery was actually so old that it had begun to swell a bit. This is a sign the battery is failing and can be dangerous, so use caution if you do replace it on your own.
*GenerateWindows 10 BatteryReport using POWERCFG command
Open CMD in Admin Mode as above.
Type the command: powercfg /batteryreport. Press Enter.
To view theBattery Report, pressWindows+R and type the following location: C:\WINDOWS\system32\battery-report.html. Click Ok. This file will open in your web browser.
Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".