President Megawati Sukarnoputri marched along the red carpet under a threatening sky, dressed in a brown Indonesian Girl Scout outfit. Then, stepping forward to face nearly a thousand uniformed boys and girls arrayed along the field, Megawati raised her right hand to her scout's cap and saluted.

The television cameras rolled.

Struggling for political survival after she narrowly qualified for a presidential runoff to be held next month, Indonesia's famously aloof president has emerged from the palace and braved the hustings. She has discovered in recent weeks what many world leaders learned of long ago: the power of incumbency.

Megawati has much ground to make up in her reelection bid against front-runner Susilo Bambang Yudhoyono, her former chief security minister. Opinion polls have shown Megawati trailing by as much as 40 percentage points. But official campaigning is banned until the week before the Sept. 20 runoff.

So Megawati has taken the presidency on the road, trying her hand this month at inaugurating a highway bridge, railway line and water system on the western side of Indonesia's main Java island, home to the majority of voters. She has flown several times to the east side of the island, reviewing a reforestation project, awarding grants to small entrepreneurs and participating in a puppet show. She has presided at arts festivals and posed for pictures with Miss Universe.

"The shock of the legislative election gave Megawati a renewed energy and so she became a much more visible president and seems to be hands-on," said political commentator Dewi Fortuna Anwar.

What may be common sense for other embattled leaders is novel for Megawati. She has spent much of her three-year tenure sequestered in the palace or traveling abroad. When hundreds of thousands of Indonesian migrant workers fled back home from neighboring Malaysia two years ago during a crackdown on undocumented laborers, Megawati did not head for the squalid camp where 22,000 were living with little food and drinking water. Instead, she embarked on an unrelated two-week tour of African and European capitals. She was roundly criticized in the local press, but did not change her style.

That was, until her party, the Indonesian Democratic Party of Struggle, was battered in the April parliamentary elections, securing only 19 percent of the vote. Voters had registered their discontent with a government that many said was indifferent to a sluggish economy and rampant corruption. Then, in the weeks leading up to the July presidential contest, her popularity in the polls sagged as low as 11 percent, shaking her confidence that she remained widely respected as the daughter of Indonesia's founding president Sukarno, according to senior political activists working with her campaign.

Less than a month before the July vote, her advisers hurriedly prepared television advertisements portraying her as a mother figure often surrounded by schoolchildren. Coupled with her new willingness to stump in markets and bus stations, the revamped approach helped her battle back. She wound up with 27 percent of the vote and a slender second-place finish behind Yudhoyono in a field of five candidates.

"She's following the same successful strategy, only expanding it," said Rizal Mallarangeng, a political analyst close to the president. "The basic message is: Stay with her. She may have weaknesses, but she's done something too for the country."

Megawati continues to strike the pose of president as mother. Last weekend, she and her husband, Taufik Kiemas, who is also her key political operative, donned scout uniforms, complete with neck scarves in Indonesian red and white, to help celebrate the anniversary of the country's scouting movement.

Standing on a low outdoor stage under patriotic bunting, Megawati watched as young scouts in white gloves barked out national pledges and principles of scouting. She then took a prepared speech from her police aide-de-camp and addressed the scouts on the value of good character, as cameras recorded the event for the nightly news.

She delivered the speech with little passion, only sporadically glancing up from the text.

But her emphasis on moral character played to an electorate that pollsters say will pick their president based largely on personality and not issues. Megawati and Yudhoyono, both secular nationalists in this overwhelmingly Muslim country, are open to cooperating with the United States in combating international terrorism.

Yudhoyono has remained relatively quiet because of a ruling by the national election commission limiting campaigning to three days next month, largely to prevent clashes between supporters of the rival candidates.

But Megawati has taken advantage of celebrations surrounding the Indonesian independence day on Tuesday to display her nationalist credentials and eluded bans on campaign advertising by recording presidential messages to mark the holiday.

Yet it remains uncertain whether all this will be enough for her to overcome Yudhoyono's advantage. She remains wary of public debates and although she has dropped her long-standing reluctance to give news media interviews, they are often sterile conversations.

"Megawati has to have courage and use every moment," said Imam Prasodjo, a sociologist at the University of Indonesia. "But Megawati is a person who is not really comfortable having a dialogue with the people. . . . I'm not sure Megawati has the capability to change her style in this very short period of time."

Indonesian President Megawati Sukarnoputri, left, and Vice President Hamzah Haz attend an anniversary ceremony for the scouting movement.