LOS ANGELES (AP) _ Pianist and composer Ervin Nyiregyhazi, who as a child was the toast of Europe but whose later years were spent in relative obscurity, has died at age 84.

The Hungarian-born musician, who died Monday, began composing at age 4, was performing his own works at 5 and was the subject of a psychological study on the child prodigy.

In his youth, he performed for Europe's crowned heads and won acclaim for his mastery of the Romantics, particularly Franz Liszt. He made his debut at New York's Carnegie Hall in 1920 at 17.

Five years later, his career lay in ruins, a combination of a revolt of the modernists against romantics and a lawsuit over money Nyiregyhazi brought against his manager.

As an adult, he performed sporadically but married often, a total of 10 times.

He came to Los Angeles at the suggestion of an old friend, novelist Theodore Dreiser, and went to work at Hollywood's United Artists, where he did mostly studio work.

He also played with Works Progress Administration orchestras for $90 a month during the Depression.

His hands were photographed playing piano in ''Song of Love'' and ''Song to Remember'' although Arthur Rubinstein and Jose Iturbi, respectively, were the off-screen pianists for those films.

In 1935, while at the piano at a friend's home, he was heard by Arnold Schoenberg, father of the 12-tone composition.

Schoenberg wrote to conductor Otto Klemperer, comparing Nyiregyhazi to Liszt. But when Nyiregyhazi played for the great German maestro, he transposed some Chopin to suit himself. Klemperer was offended.

''I never heard from him again,'' Nyiregyhazi said in a 1978 interview with the Los Angeles Times.

Nyiregyhazi had been out of the public eye for decades until 1973 when he appeared unannounced at a small concert in San Francisco to help defray the medical expenses of his ninth wife.

A record executive tape-recorded his playing. Out of it came a Ford Foundation grant of nearly $40,000 that enabled Nyiregyhazi to subsist for his remaining years.

He once estimated he had 12,000 pages of manuscripts in bank vaults in Los Angeles and San Francisco and was asked if he had taken any measures to preserve them.

''I have been rejected all my life as a pianist,'' he said. ''Why should I also ask to be rejected as a composer?''