"IRON MAN 3" is good fun, and the story of how the franchise got its groove back is one of those strange only-in-Hollywood tales.

Cut to 2004, when fallen star Robert Downey Jr. was trying to mount a movie comeback after rehab and exile - a history of arrests and relapse had made him uninsurable and nearly unemployable. Producers withheld salary until wrap day; friends paid his insurance bond.

He was offered the lead in an offbeat mystery-comedy called "Kiss Kiss Bang Bang" and took it, and while the movie didn't make much money, it reaffirmed Downey's chops - his speed-bag way with dialogue, his gift for blink-of-an-eye shifts from comedy to drama.

He followed with a plum role in David Fincher's "Zodiac," and within a year the once untouchable, unreliable actor was cast to anchor "Iron Man," the sort of franchise gig that is corporate Hollywood's highest honor (if you squint at Iron Man, he looks like an Oscar statue).

In Downey's business, the best revenge is being in "The Avengers."

As for "Iron Man" itself, it hit a bit of a sophomore slump with "Iron Man 2," and when it came time to inject new energy into the series, the studio turned to writer-director Shane Black - the very fellow who gave Downey the starring role in "Kiss Kiss Bang Bang."

Chemistry isn't always between the leads - sometimes it's between the director and star - and these two have it. In "Iron Man 3," Downey is like a juggler catching beanbags, bowling balls and chainsaws, and keeping them aloft like its no big deal. Black is the guy throwing them - "Iron Man" has the same playful twists of plot and tone as their previous collaboration.

"Three" follows the general guidelines of hallowed Marvel scripture, but with its own inventions and improvements. Tony takes on a terrorist bomber known as The Mandarin (Ben Kingsley) with links to a shadowy industrialist (Guy Pearce). Clues to the mystery rest with one of Tony's ex-girlfriends (Rebecca Hall).

The less said about the plot the better, but Black's spin on The Mandarin gives Kingsley room to do some wonderful supporting work here. There are other smart riffs - a Stark worshipper (Adam Pally) in a satellite truck becomes a funny quick-sketch portrait of excessive fanboy geekdom. Black also gives us the healthier version, a young Stark fan (Ty Simpkins) who helps a down-but-not-out Tony get back on his feet, literally and otherwise.

The real subject in "Iron Man 3" isn't the Mandarin, it's Stark's middle age, his domestication. He's married (Gwyneth Paltrow returns as Pepper Potts) and stepping away from the careless playboy whose youthful arrogance and hubris now haunt him.

Stark seems happy to turn the muscle work over to Iron Patriot/War Machine (Don Cheadle), who turns up in the clanging finale.

No one seems to know how to end one of these things, and we get the usual gigantic bonfire of special effects. Still, Black holds his own, and comes up with a clever way to exploit Tony's new segmented suit, with independent components that answer to Tony's command.

One that doesn't answer to his command is his heart, and by movie's end he's ready to trade his fusion-powered version for the real thing.

Blog: philly.com/KeepItReel

Online: ph.ly/Movies