The actor follows up 'Scrubs' by writing a play. It's been a dream since boyhood. 'All New People' is now playing off-Broadway with 'The Hangover's' Justin Bartha in the lead role.

Zack Braff at his New York home with his dog Roscoe. (Carolyn Cole / Los Angeles…)

Reporting from New York — — If there's one thing Zach Braff wants people to know, it's that it wasn't vanity or ego or even professional pride that made him turn to playwriting. It was a long-suppressed impulse.

"I'd always fantasized about writing a new play," Braff said. "Even when I had all this success in television, what I was daydreaming about in my dressing room is that one day I would do it."

When the offbeat comedy completed its nine-season run last year, Braff left behind his man-child character of Dr. John "J.D." Dorian (a.k.a. "Betsy," "Newbie," "Carol") to get in touch with his inner Eugene O'Neill. Braff said he has been preoccupied with doing so ever since his father let him hang around and "be the mascot" at the community theater that Hal Braff ran near his family's suburban New Jersey home.

So the actor, 36, has written "All New People," a dramatic comedy that opened this week at the Second Stage Theatre, a prominent off-Broadway venue, where it will run through at least mid-August. So far the reviews have been solid, if not overly effusive.

In this crossover age, television and film actors make the jump to the stage all the time. But they're usually standing on it, not looking at it from the back row as their words are hashed out in endless rehearsals. (Braff wanted to star in "All New People" as well, but some veterans at the theater talked him out of it, telling him that a writer couldn't get a clear perspective on a new work that way.)

A few hours before the show was set to open, Braff tucked one leg under the other on a single-seat sofa 11 stories above Manhattan's Union Square, in the loft-like apartment he shares with his girlfriend, the model Taylor Bagley, and their two lap dogs, Roscoe and Scooter. The place is filled with an assortment of high-end kitschy accessories (a vintage typewriter, a coffee-table book about the collected output of Burt Reynolds) and several college dorm-like accouterments (photographs of Braff with the pooches). Say what you will about the celebrity life, it isn't always about enjoying tropical breezes. Braff woke up at 5 a.m. in Detroit, where he is shooting Sam Raimi's "Wizard of Oz" prequel "Oz," spent seven hours on the set, flew into New York for the opening, and will return to Detroit sometime around midnight so he can resume shooting the next day.

The actor has put in more than a year writing and workshopping "All New People," calling on various theater luminaries, including the Tony-winning director George C. Wolfe. "This is me," Braff said. "I'm putting myself out there in a way I don't know if I ever have before. This is what I think; this is what I find funny. This is what I and my peers are obsessing about and brooding about and laughing about."

When we first see main character Charlie (Justin Bartha, in about as different a guise as you can imagine from his "Hangover" role) is one unfinished cigarette away from hanging himself in a sleek Long Beach Island, N.J., summer house in the dead of winter. Charlie's march to the smoker's lounge in the sky is interrupted by daffy young real-estate agent Emma (Krysten Ritter), who walks in on Charlie mid-hang. She tries to talk him out of it, he grumpily resists, and before long Emma's friend Myron (David Wilson Barnes), a literate firefighter with a slight substance-abuse problem, and a wide-eyed prostitute named Kim (Anna Camp) have shown up to hurl R-rated one-liners and get to the bottom of everyone's spiritual pain.

The emphasis is on the spiritual. For an actor who's never evinced a particular interest in matters religious — "Scrubs" fans can picture Braff more easily breaking into "99 Luftballons" than "Amazing Grace" — themes of God and faith are surprisingly front-and-center.

"In theater or movies you see either 'I'm religious' or 'I'm an atheist,'" said Braff, who was raised a Conservative Jew but does not consider himself a practicing member of any faith. "I've never seen too much discussion of 'I believe there's a higher power but I'm hesitant to reach out to him because I don't know if I'm worthy of his attention.'"

The ambition of his work is both a virtue and a risk, say those performing it. "Zach has a very cinematic perspective on things," Bartha said. "He's very sensitive and very emotional and very much a visual person. Reining in that vision and what he wants to say in a confined space was the challenge. He want to say so many things, and you only have 90 minutes and one room and four characters."