“The Rocky Horror Picture Show” didn’t invent midnight screenings, but the Tim Curry/Susan Sarandon-starring musical turned the phenomenon into an art form.

The film celebrates its 40th anniversary this week. It opened Sept. 26, 1975, advertised with the iconic poster of a lipsticked mouth with the tagline “A different set of jaws” — a reference to Steven Spielberg’s shark movie, which had opened three months earlier.

Execs at 20th Century Fox knew they had an unusual film which would require a different approach to marketing. Before the film’s U.S. premiere at Los Angeles’ UA Westwood theater, Fox hired a promotion company to distribute flyers to people in line at other films, concerts and clubs, at beaches “and other spots where youth gathers,” said a Daily Variety story at the time. The company handed out 100,000 flyers in the eight weeks before the film opened, which included postage-paid envelopes to buy reserved tickets for the first shows.

It worked. In its first three days at the theater, “Rocky Horror” sold out and earned a promising $13,250. But it was downhill from there. The horror-comedy-musical underperformed at the few other theaters where it was screened; Fox withdrew the prints, and cancelled the New York City opening, which had been scheduled for Halloween night.

Most studios would just move on, but Fox exec Tim Deegan persisted. He contacted Bill Quigley of Walter Reade theaters and they talked about a midnight show. Deegan noted that a lot of the reason for success at the UA Westwood had been repeat business: In the pre-VCR era, fans wanted to see the film again and again.

“Rocky” resurfaced on April 1, 1976, at the Waverly in New York, with midnight screenings. The showings were billed as “previews,” which meant that the film didn’t officially open in N.Y. — in other words, no reviews for magazines or Gotham newspapers. Despite resistance from most execs, Deegan got support where it counted: from studio head Alan Ladd Jr.

A Variety article on April 14, 1977, assessed the film’s financial history: “Failure? Yes and no.” It cost about $1 million to produce, with added costs for marketing and distribution; it returned $400,000 to Fox in its first 19 months, causing the studio to take a writedown. However, its success was building; in its first 52 weeks of midnight screenings at the Waverly, B.O. averaged $1,800 per week, with $1,150 of that returned to Fox. Marketing costs: $58.73 a week, for a little ad in Village Voice. And the box office was increasing in its second year.

Meanwhile, the film was also scoring in Austin, where ad costs were zero. Soon Fox had 20 prints in circulation, and rentals averaged $27,000 for 48 weeks. The midnight showings expanded into other cities and by the end of 1980, it had played at more than 200 theaters and Fox had earned a net profit of $11.5 million.

In the modern corporate world, these numbers would be considered trivial. But “Rocky Horror” continued to perform; after 96 weeks of sellouts in N.Y., the film moved to the New Yorker, because Waverly neighbors complained about the oddly-dressed and noisy fans (who queued up many hours in advance). And it continued playing midnight shows for decades.

In March 1971, Variety credited the midnight phenomenon to“El Topo,” a trippy Western directed by Alexandro Jodorowsky, which had opened at Christmas 1970 at New York’s Elgin Theater; it cost $350 a week to keep the theater open that late every night, and the weekly income was about $4,000. The “El Topo” pattern was soon followed by “Pink Flamingos,” the 1936 “Reefer Madness,” “Harold and Maude” and “King of Hearts.”

But “Rocky Horror” added another level of enjoyment to midnight screenings, since some theaters gave free (or discounted) admission to anyone in costume, and people started showing up as their favorite characters, singing along and vocally interacting with the onscreen action. (Among the items frequently brought to throw at the screen were toast, newspapers, confetti, rice, toilet paper and a deck of cards.)

“Rocky Horror” ended up earning more than $100 million in the U.S., and inspired countless revivals of the original stage work by Richard O’Brien, a British-born, New Zealand-raised actor.

The film, like the stage show, was directed by Jim Sharman, a Sydney-born helmer who grew up in a circus. Sharman only made three other feature films, including the 1981 “Shock Treatment,” starring Cliff De Young and Jessica Harper as Brad & Janet, the “Rocky Horror” protagonists who this time are contestants in a quiz show. That semi-sequel has a cult following, but could not duplicate the success of the original (which also starred Barry Bostwick and Meatloaf).

Despite its rocky beginnings, “Rocky Horror” was a defining work for all of the artists involved. And, as a bonus, the United States National Film Registry in 2005 named it as being a work that was “culturally, historically, or aesthetically significant.” Not bad for a film that was initially dismissed as a write-off. And there’s a lesson here for every exec who thinks that a film’s life depends on opening-weekend numbers.