By 2006, Daniel Barnz had been working for a decade penning screenplays with big stars attached. The problem was that none of them — including “Sugarland,” which Jodie Foster was attached to direct, and “Under and Alone,” which Barnz co-wrote with Ned Zeman for Mel Gibson — actually got produced.

Frustrated, Barnz made a vow that spring. “I said that if by November 2007 I didn’t have a film in production, I was going to leave L.A. and move with my family to Africa to live with the elephants,” Barnz says, with a laugh. “I have a bizarre obsession with elephants.”

The safari life would have to wait. Not long after making that vow, Barnz obtained financing to shoot “Phoebe in Wonderland,” which he wrote and directed. The film, unspooling in the dramatic competition at Sundance, centers on a 9-year-old girl (Elle Fanning) who exists in a world of magical realism that entangles both her mother (Felicity Huffman) and drama teacher (Patricia Clarkson).

Popular on Variety

“It is incredible that this is my first project to get made,” Barnz muses. “It was the very first thing I ever wrote, and it is extremely dependent on execution, so it was really, really hard to raise the money.”

There was also the matter of Barnz, a graduate of Yale and USC film school, being a first-time director with only shorts to his credit.

Securing Huffman’s attachment to the film was the key to getting it funded. Barnz’s life partner Ben Barnz, a producer on the film, fortuitously got the script in Huffman’s hands just before “Desperate Housewives” made her a star.

“I always have a hard time reading scripts, but I just flew through ‘Phoebe,’ ” Huffman says. “It was a wonderful script — a small, compelling story, beautifully told.”

To her delight, the actress adds, Daniel Barnz proved to be a capable director as well as a gifted screenwriter. “There’s only a handful of guys who can (write and direct),” Huffman says, “and Daniel is one of them.”

Up next for Barnz? He hopes to direct another screenplay he wrote, “Wisecracker,” which is about Billy Haines, Hollywood’s first openly gay star.

AGE: 37
PROVENANCE: Gladwyne, Penn.
INSPIRED BY: “Heavenly Creatures,” which influenced the making of “Phoebe in Wonderland.” “It captures perfectly that sense of childlike infectiousness and giddiness and walks that really fine line between the beauty and horror of children’s imaginations,” Barnz says.
REPS: Agents, Adriana Alberghetti and Bill Weinstein (Endeavor)