Hold the flush-mount box against the ceiling and trace the outline of the back of the box on the drywall with a pencil. Be sure there isn't a rafter behind the drywall, but If you aren't sure, use a stud finder to locate them.
Cut out the outline with a drywall saw and remove the cut-out. Place the box in the hole to make sure it fits snugly, widening the hole slightly with the saw if necessary, then remove the box.
Turn off the power supply at the circuit box or breaker. Pull the wires you need to make your connection through the hole.
Feed the wires into the self-clamping holes on the back of the flush-mount box and pull them through from the other side, giving yourself about 6 to 8 inches of slack so you can make connections.
Place the box in the hole, pushing the extra wire into the hole and behind the drywall as you do, and push until the lip around the front of the box contacts the drywall. Push in one of the screws on the front of the box with a Phillips screwdriver and turn it to engage the anchor on the back of the screw with the back of the drywall. Repeat with the other screw.
Pull the box slightly toward you with one hand while you tighten the screws with the screwdriver. As you tighten the screws, the anchors clamp the box to the ceiling. When the screws are tight, finish making the electrical connections.