A method for focusing by using a pre-flash is provided. The method
includes the following steps. First, the image sensor captures a first
image of the object, wherein the average brightness of the first image is
calculated to be Y.sub.0. Next, the image sensor captures a second image
of the object with the aid of a first pre-flash having a first energy,
wherein the average brightness of the second image is calculated to be
Y.sub.1. Afterwards, the image sensor captures a third image of the
object with the aid of a second pre-flash having a second energy, wherein
the average brightness of the third image is calculated to be Y.sub.2.
Then, the distance D to the object is calculated according to the
brightness Y.sub.0 and the difference .DELTA.Y between Y.sub.1 and
Y.sub.2. Finally, the image sensor adjusts the focus according to the
distance D.