Direct flat-panel detectors using amorphous selenium (a-Se) x-ray photoconductors are gaining wide-spread clinical use. The goal of our investigation is to understand the physical mechanisms responsible for ghosting, i.e., x-ray induced change in sensitivity that results in image persistence, so that the knowledge can be used to consistently minimize ghosting artifacts in a-Se flat-panel detectors. In this paper we will discuss the effect on x-ray sensitivity of charge trapping in a-Se, which is the dominant source for ghosting in a-Se flat-panel detectors. Our approach is to correlate ghosting in electroded a-Se detectors with the trapped charge concentration measured by the "time-of-flight" (TOF) method. All measurements were performed as a function of radiation exposure X of up to approximately 20 R at electric field strength's of E(Se)=5 and 10 V/microm. The results showed that the x-ray sensitivity decreased as a function of X and the amount of ghosting decreased with increasing E(Se). The shape of the TOF curves changed as a result of irradiation in a manner indicating trapped electrons in the bulk of a-Se. The density of trapped electrons n(t) increases as a function of X. A method was developed to determine the values of n(t) in the bulk of a-Se from the TOF measurements, and to predict the corresponding change in x-ray sensitivity. Our results showed that a recombination coefficient consistent with that predicted by Langevin produced good agreement between calculated and measured x-ray sensitivity changes. Thus it can be concluded that the trapping of electrons in the bulk of a-Se and their subsequent recombination with x-ray generated free holes is the dominant mechanism for ghosting in a-Se.