'Iron Man 2' Features DJ AM Cameo

'We tried to make it respectful, and for people who know him, they'll get a kick out of it,' says director Jon Favreau.

Over the course of his career, the late [artist id="1562979"]DJ AM[/artist] (born Adam Goldstein) played countless celebrity parties and gatherings, but one of his last was captured on film in what could be one of the year's biggest blockbusters.

According to the Los Angeles Times, two months before his death in August of an accidental drug overdose, AM filmed a cameo in a key scene in "Iron Man 2" that the paper said gives the film a "bittersweet backbeat."

"We tried to make it respectful and for people who know him, they'll get a kick out of it, and for people who don't it will sort of slide by without much notice," said director Jon Favreau, who struggled with the decision to leave the scene in the film's final cut. Favreau invited AM to the film's set last spring and instantly bonded with the celebrity DJ. But after AM's sudden death on August 28 at age 36, the director was unsure if filmgoers would see the inclusion of the footage as a touching farewell or a jolting distraction.

In the film, which opens on May 7, AM is seen manning the turntables at a wild birthday party at boozy Tony Stark's Malibu estate. Wearing his superhero armor, Stark (Robert Downey Jr.) is seen dancing around to Tupac's "California Love" as spun by AM. According to the paper, the party soon turns nasty and Stark says, "Adam, I need a fat beat."

"I was just a fan of his, just an admirer of his work, and it was supposed to be a one-day bit," said Favreau, who sometimes spins records himself for friends at home. "But Robert took a real shine to him, as we all did. His energy was amazing. He was such an inspiring guy and there was a lot of depth to him and this positive energy. He ended up staying on with us for about a week and it was just great. We set up this turntable and between takes he would give me pointers."

When editing the movie, Favreau looked to people who were close to AM to figure out how much, if any, of the footage should be used in the film, which mixes intense action with a sometimes-lighthearted tone. According to the Times, everyone consulted agreed that AM should get one more chance to hype up a crowd, his biggest ever, which inspired Favreau to keep the footage in the movie.

As a result, the film is dedicated to AM, with his name and signature lightning-bolt logo scrolled in the end credits. Favreau said after the DJ's extended two-week stay on the set, there was "never any doubt" the movie would be dedicated to AM. "When he passed, it was very difficult for a lot of us," Favreau said of his fast friendship with AM and the difficulty for recovering addict Downey to watch a fellow recovery veteran — AM had been sober for 11 years before his death — falling so hard and fast.

"Our heart goes out to his family and friends," Favreau said, "and we hope what we've done is pleasing to them and to the many, many people who held Adam in high regard."

Check out everything we've got on "Iron Man 2."

For breaking news, celebrity columns, humor and more — updated around the clock — visit MTVMoviesBlog.com.