Those are built with Adobe Flash and ActionScript, and that is the honest answer.
Flash has historically cost several hundred dollars for a licence, though Adobe's shift to Animate and the wider availability of the tools has changed the pricing picture somewhat. There are free alternatives — open-source engines and HTML5 frameworks — but the learning curve is steeper and the tutorials thinner.
Either way, ActionScript or JavaScript is the skill to learn first. Search for tutorials on the language and start with something small, like a match-three prototype, before attempting anything PopCap-sized.