– In the 14 months since Zynga sold shares to the public, the online game developer has been on a monumental ­losing streak. Games have been killed, crucial employees have fled and players have sought excitement elsewhere.

Any hopes that Zynga’s luck had substantially improved were dashed Tuesday when the company reported its fourth-quarter earnings. They were expected to be weak and they generally were, if not as bad as some had feared.

Revenue was $311 million, flat with the year before. Daily users of the games were down 6 percent from the third ­quarter, a clear measure of flagging interest. More casual users dropped as well.

Earnings per share were a penny, better than the 3-cent loss that analysts had been expecting on an adjusted basis. And Zynga’s cash hoard of $1.65 billion was untouched.

For the full year, revenue was $1.28 billion, up 12 percent from 2011. Not exactly what you would expect from a growth company.

Yet the company’s shares immediately rose in after-hours trading by 7 percent. In regular trading they were also up 7 percent, to $2.73, largely on the basis of an analyst upgrade from Merrill Lynch. Many online stock sites, by contrast, have been portraying the company as going the way of Pets.com or MySpace. “Zynga’s Earnings May Reveal Its Impending Demise” read the headline at one of them.

Michael Pachter, a managing director of Wedbush Securities, is a Zynga ­optimist, of a sort. He wrote in an e-mail before the earnings were released that he had “100 percent confidence” the company could pull off a turnaround but “zero confidence that they will.”

Zynga’s diminishing fortunes illustrate how quickly the prospect of Internet companies can wax and wane — a development compounded by the shift to smartphones. And it has a crucial test coming up: Can it successfully move its most popular games, starting with the “Farmville” franchise, from PCs to mobile devices?