HOLLYWOOD — Unfortunately for Spike Jonze, the pivotal role of "Samantha" in his new sci-fi tinged romantic drama "Her" had to be recast after the film was already in the can. Luckily for Spike Jonze, "Samantha" is actually a computer operating system - i.e. she's never actually seen on-screen.

"When we shot, we initially had cast Samantha Morton [in the role]," Jonze said at a Q&A following Wednesday night's AFI Fest screening of the film. "So Samantha was really involved in giving Joaquin [Phoenix] a lot...to work from. And then when we got into editing, we realized that what Samantha and I had done together wasn't working for what the character needed, and so we ended up having to recast at that point in time."

Stepping in for Morton during the post-production process was Scarlett Johansson, who was initially daunted by the challenge of creating a character that begins the film as a neurosis-free computer-generated voice -- initiated to be a companion for Phoenix's lonely soon-to-be-divorcee Theodore Twombly -- who gradually comes to feel the weight of real human emotions.

"When [Scarlett and I] first started working on it together -- I was in New York and she came over and we read a bunch of the scenes -- one of the things I was saying to her was that when Samantha's created, she doesn't have any fears or doubts or insecurities or baggage," Jonze said. "Like we are...we learn those, we learn self-doubts and we learn those things. And I think it was at that point she was like, 'Oh, OK, this is gonna be hard. This is gonna be harder than I thought it was gonna be.'"

"Her" may sound like something of a downer on paper, but the film succeeds partially on the strength of its lighter moments, including the incorporation of a hilariously foul-mouthed video-game character dubbed the "alien child" (designed by Irish animator David O'Reilly) that becomes a recurring presence in the film.

"That's actually Spike's voice," said producer Megan Ellison after being dragged onto the stage by her director during the Q&A (the credits list the voice actor behind the character as Adam Spiegel, Jonze's birth name).

"I would love to make video games," said Jonze after being asked whether he harbored any future ambitions in the gaming industry. "So that was a way of getting to be a fantasy video game maker. The alien child was really fun to write."

In addition to the film's voiceover performances, "Her" also benefits aurally from a score by Grammy-winning Canadian rock band Arcade Fire, fronted by lead vocalist and songwriter Win Butler.

"The [band] was working on [their latest album 'Reflektor'] as they were working on this," said Jonze of collaborating with the group on the film's soundtrack. "Win and I started talking about the score about two years ago, and then it kinda seemed like the record sort of informed the soundtrack and the soundtrack informed the record a little bit, and there's like a song on ['Reflektor'] -- the last one, "Supersymmetry" -- that he wrote for the movie, but then it sort of became something else. It's actually the last song in the end credits."

True to the film's mixture of near-future sci-fi (the Los Angeles depicted here feels like a natural extension of the technology-crazed present we inhabit now, sometimes nauseatingly so) with very real human emotions, the score's pulsating rhythms feel like the creation of some artificial intelligence just now evolving into a more sentient, feeling being, i.e., one not unlike Samantha herself.

"What Win and I started talking about in the beginning was just that we wanted the soundtrack to have this electricity to it, a current to it," Jonze said, "but not to be electronic and not to...use synthesizers at all. For it not to feel synthetic, but to feel like hand-made, but still have an electricity to it, and also just to sort of play this sort of romance and love story and longing of Theodore."

"Her" hits limited theaters on December 18 and moves into wider release in January.