As you've probably noticed now by the responses to your post, there's no one way, or a "right" way and a "wrong" way, except to say that whatever works is right, and whatever makes you throw the model against the wall is wrong.
I'll paint things before assembly, if it makes sense, like painting the instrument panel before installing it, painting a tank's interior before closing up the hull, but I'll paint the exterior of an airplane after assembling the fuselage and wings. I find it easier to deal with seams by doing it that way.
Painting a figure, I'll paint things before attaching, if it's easier to get to them at that stage, but otherwise, I'll paint the figure from the inside out, flesh areas first, then general uniform or clothing, and then equipment.
And yes, some things I paint on the sprues, too, occasionally, but I find generally that most things are better painted once they're removed from the sprues and at least partially assembled, because if I leave them on the sprues, I still have to clean up the sprue gates.