Projective modules

I have to prove that if $P$ is a $R$-module , $P$ is projective $\Leftrightarrow$ there is a family $\{x_i\}$ in $P$ and morphisms $f_i\colon P\to R$ such that for all $x\in P$ $$x= \sum_{i\in I} f_i(x)x_i$$ where for each $x\in P$, $f_i(x)=0$ for almost all $i\in I$.

Any help?

-
I think you misstated when you wrote $f_i=0$ for almost all $i$; you mean that for each $x$, $f_i(x)=0$ for almost all $i$ (that is, the ones that are nonzero depend on $x$; otherwise, the statement would be that there are finitely many functions such that...) –  Arturo Magidin Sep 23 '10 at 20:04

Put the $f_i$ together to form one giant $f$ from $P$ to $R^{(I)}$, the direct sum of $I$ copies of the ring $R$. The condition that $x = \sum f_i(x) x_i$ just means that there is some $g:R^{(I)}\to P$ such that $g(f(x)) = x$, namely $g((r_1,r_2,...)) = r_1x_1 + r_2x_2 +\cdots$. In other words, $P$ is a direct summand of the free module $R^{(I)}$.