I've been married 12 years and sometimes I flirt with strangers just to see if I've still got it.
I want to know why you do such a thing while married.
I want to know how they will respond and check if I can still get them and also see if they find me attractive.
You're pretty insecure if you need these random strangers to validate your worth. Flirting like this when you're married is really scummy.
How else am I supposed to find out if I'm still attractive?
You should seek validation from your partner but most importantly yourself. That's how you'll be more secure.