It’s lunchtime on Broadway, so when the elevator door opens on the ground floor of the 42nd Street Studios rehearsal space, I swim against a tide of working actors. Director Michael Mayer moves his hands in animated impresario mode, comedic actress Harriet Harris promises to catch someone later, and a school of dancers tightens their scarves against the February rain. The cast and crew of Thoroughly Modern Millie -- the $9 million musical about a glam-famished farm girl-cum-flapper who takes 1922 Manhattan by storm -- have returned from a triumphant test run in La Jolla, California, to, well, take Manhattan by storm.

On the seventh floor, in a large mirrored studio with vast windows opening onto Times Square, the brown-baggers are still buzzing about this line or that dance step -- or Dreamgirls’ Sheryl Lee Ralph just joining the cast. Enter lyricist and cowriter Dick Scanlan, all purple-turtlenecked grace under pressure. He is finishing a meeting, confirming a schedule and saying hello to a friend. The Millie family of perfectionists is this close to opening night -- April 18 at the Marquis Theater -- so the urgency in discussing last-minute touches is understandable. But Scanlan, 42, has sustained this fevered pace for more than a decade -- ever since Millie first entered his life begging to be freed from VHS camp hell. The admittedly lackluster 1967 film starred Julie Andrews, Carol Channing and an elevator that only worked when one tap-danced inside it. But Scanlan is quick and, it turns out, right -- as Millie’s pleased producers (including Whoopi Goldberg) and previewers attest -- to defend the essence of the work. “It’s a coming-of-age story about a conflict of values,” he says as we sit down in the eye of the rehearsal storm. “That’s why it’s so personal to me. All I knew at 18 was that the life I’d been raised in was not for me.” In Millie’s first song, “Not for the Life of Me,” she sings: “Clap your hands, just because where I am ain’t where I was.”

In the movie Millie, New York City serves as a zany backdrop, but the play is a heartfelt valentine to the city that Scanlan has lived in and loved for two decades. “One of the things that’s happened since September 11 is that America has realized that New York embodies the national spirit of transformation,” he says. “That constant ’Who knows what’s around the corner?’ And it can be whatever you want if you’re willing to work and chance and fail and get back up again.” Scanlan shifts in his seat, recrossing his long legs. “But often you end up in your new place with only an external idea of what life is,” he goes on. “For me -- and I think it’s true for a lot of young people -- you try things on. When I first came to New York, I smoked clove cigarettes and wore clogs and -- you know -- went too far to try to live in a picture of a life that got me out of suburban Maryland. And then, as you grow up, you begin to take responsibility and realize that every choice means you’re letting go of something to get something else.”

Millie’s initial plan is to marry rich so that she can live in the heart of New York’s newsreel fabulousness. Her trade-off is that she give up love -- a tad venal for a Midwesterner, but we’re all young once. “Of course, in the end,” Scanlan says “she decides to opt for love. But if you’re marrying someone who doesn’t have means, you give up a certainty of what your future will be. And that’s where values come in, asking ’What is the one thing that is important to you?’”

Is Scanlan’s professional life a play of “What I did for love”? “Well, of course,” he says, as if there were no other answer. “I know my ambition is there,” he says, “because I work ’round the clock seven days a week and I’ll pursue anything I feel passionate about, but it’s not about wanting to see my name in the paper. It’s some kind of drive that’s personal.” Between two Septembers in the early ’90s, when AIDS almost killed him, Scanlan worked at a breakneck pace on Millie while saying his good-byes. The easy answer to the question of how he survived is that the Grim Reaper stoked his ambition to “leave a mark.” The fact is, his mother dragging him to The Sound of Music at age 5 had already lit that spark.

During the ’80s, Scanlan struggled as an actor, landing the odd bit in Another World between catering gigs. He found a boyfriend in Kees Chapman, an all-male movie director. By 1987 they knew they both had HIV. Chapman died in July of the following year, just shy of a law degree and the prime of a second act. In his final, fevered haze, the man who’d been so good to Scanlan lamented having been “so bad.” Devastated, Scanlan was dreading what his own future held.

Three years later, Scanlan was cast as Bonnie Louise Cutlet in the cult drag hit Pageant. For 500 performances, audiences packed the off-Broadway Blue Angel Theater to vote which of the six men -- in evening gowns and fanged smiles -- would snare the night’s title of Miss Glamouresse. "I would never have written without Pageant. It opened me up. All my life I’d been called a ’girl’ in such a negative way. And here I was playing a girl and getting rave reviews and the audience’s love," he says, cupping his hand to his heart.

With this new insight into the man inside the swimsuit and wig, Scanlan challenged himself to do what Chapman had long urged: write. Somehow his fate was sealed when he thought of bringing Thoroughly Modern Millie to the stage. “I knew it had to be a Broadway musical,” Scanlan says, “because that’s the size of the story.” But Scanlan needed writing credits under his belt before he could command a million-buck production. He put acting aside to pen stories for The New Yorker, articles for Vanity Fair, even doing a stint as Playboy’s fashion editor (an ironic title with great rates) and contributing editor at POZ.

In 1993, Scanlan first contacted Thoroughly Modern Millie’s screenwriter, Richard Morris, to ask about the rights to the film. He recalls one incident at Morris’ home in Los Angeles. "There was a royalty check for The Unsinkable Molly Brown,“ he says, ”which Morris had written for Broadway. It must have been a good one because he got a big smile. And he looked at me in a sort of father-son way and said, ’You realize that if Millie is as good as we think it can be, it’s going to pay you a lot of money for the rest of your life.’ And, honestly, that thought had never occurred to me."

It took some convincing, but Morris eventually agreed to collaborate with Scanlan in bringing Millie back to life. The pair sparred through a first draft, but any criticism was for Millie’s benefit. “It was only confidence building,” Scanlan says. And both men needed it. Morris was diagnosed with cancer shortly after Scanlan’s first visit. Soon, Scanlan was down to 37 CD4 cells. The pair were not infrequently waiting in some emergency room or other with red pencils and Millie scripts. “We were two, dying, 6-foot-2, Irish-Catholic men named Dick,” he says, punching each word for emphasis. “It sounds apocryphal, but it’s true.” Morris died in April 1996, leaving Scanlan to carry on with Millie.

The year before, when Scanlan’s short stories were collected in Does Freddy Dance, his family and friends had assumed the book was his swan song. But there were other surprises in store as well. One winter night in New York, Scanlan was eating alone in a diner when a stranger politely asked if he cared to join him. Scanlan still recalls his icy recoil from the threat of a new man’s interest and declining the offer. But by the end of that difficult dinner he had thought better of it. Over dessert, Scanlan hit it off with this lawyer named Alan Effron -- and love walked in, uninvited but welcome.

Every Christmas, Effron gives Scanlan a video of Bewitched, the ’60s sitcom starring the late Elizabeth Montgomery as Samantha, an extraordinary woman casting spells in ordinary surroundings. "I think the metaphors in Bewitched are profound,“ Scanlan says. ”It’s the same drama of coming out in every episode: It begins with Darrin saying to Sam, ’Look, I love you, but it will bring shame to our family if anyone knows you are a witch. So please don’t use your powers.’ And through the challenge in the episode, Samantha always makes the decision that the only way to solve it is to be who she is and use her powers. And after that Darrin is very admiring." Until the following episode, when trouble brews anew at 1164 Morning Glory Circle.

Scanlan’s face glows as he speaks, and I half expect him to wrinkle his nose à la Samantha. “So whether it’s in coming out as gay or as a person with HIV, the power is in being who you are. It empowers people around you,” he says. “They respect that about you as much as they thought they might have been ashamed by it. It puts you in touch with your power as a person, your pride.”

But Scanlan won’t entertain any “A proud HIVer is a healthy HIVer” slogans. “I’m always hesitant to say my attitude is responsible for my being alive. I think of Kees and a lot of other people who died,” he says. “If I hadn’t gotten 3TC in September 1995, I could be as proud as I wanted but not be here now.”

For Millie’s producers, Scanlan had to tally the money he put into developing the show each year. The priciest was 1995 -- the year he was supposed to die. “I mean, I was on the top five list at my doctor’s office,” he says. "Another six months seemed unlikely. But I kept working on the show, investing thousands of dollars. Flying out to see Richard, putting on a reading. I could have shut down and said, ’You know, I’m not going to see Millie produced’ -- and really that would have been the logical thing.“ Scanlan looks right at me to make sure I get it. ”The fact that I’m here is ridiculous. I mean, I was sick, sick, sick -- 30 pounds thinner, scabby skin. That kind of ’Unnh!’ when they see you.“ Here, he improvs the acquaintance catching sight of a walking corpse and gripping his heart in shock. ”When you’re that ill, and you think you won’t live to see the child grow up, and you say, ’That’s OK. I’m here now.’"

Call it a labor of love or a love of labor, he never surrendered. “It was my heart telling me to do it,” Scanlan says of the decade of visions and revisions that brought him here to Broadway. "Filling my heart, threatening to break it when I thought I couldn’t solve a problem. Then solving it, and my heart expanding -- the process. Working."

To fine-tune Millie, director Michael Mayer -- a friend of Scanlan’s since 1978 -- and composer Jeanine Tesori came onboard. Tesori shares Morris’ sparring quality, and Scanlan returns in warm-hearted kind. “You only criticize someone like that,” he says, “if you think they have the goods to pull it out and do it right.”

Earlier this afternoon, fresh-faced star Sutton Foster channeled both Scanlan’s and Tesori’s youthful ghosts when she rehearsed her entrance as Millie. The flapper-to-be, just in from Kansas, sings in awe to the gorgeous Manhattan surround of skyscrapers and light: “They said that I would soon be feeling lonely/ They said that I would sing the homesick blues/ So I still have this ticket in my pocket/ This ticket home in my pocket/ To do with as I choose.”

Now, Scanlan leaps to his feet to show me the moment and is as much a just-unwrapped gift as Millie. “And she takes the return ticket out,” he says, miming the motion, “and she rips it in half. Then chucks it as she starts to sing.”

He sits down again as if at a table at the 21 Club. “When Sutton ripped the ticket, Jeanine reached over and took my hand. Beginning to work with people after Richard’s death -- I couldn’t at first figure out how to open my heart so that their hearts could be connected.” He smiles. “But with me and Jeanine now, it flows.”

Scanlan has to run. Foster is set to sing the showstopper, “Gimme, Gimme,” tonight at the star-studded GMHC AIDS benefit at Carnegie Hall. The song is written for a gold-digger, but what she’s digging for is love. “She’s going to take that single-minded ruthlessness and find true love,” he says, pointing as if it were around corner. “Because she understands at the end of the day, it’s the only thing.” And the vision in purple is gone, off to chase his true love. Clap your hands, just because where he is ain’t where he was.