$(2)解:∵AC=BC=4,∠ACB=90°$
$∴AB=\sqrt{2}BC=4\sqrt{2}$
$∵当A、E、F三点在一直线上时$
$∵∠AFB=90°$
$∴AF=\sqrt{AB^2-BF^2}=\sqrt{32-4}=2\sqrt{7}$
$如图1,当AE在AB左上方时$
$AE=AF-EF=2\sqrt{7}-2,$
$∵AE=\sqrt{2}CD,$
$∴CD=\frac {\sqrt{2}}{2}AE= \sqrt{14}-\sqrt{2},$
$如图2,当AE在AB右下方时$
$同理,AE=AF+EF=2\sqrt{7}+2$
$∴CD=\sqrt{14}+\sqrt{2}$
$综上所述,当A、E、F三点在一直线上时,$
$CD的长为\sqrt{14}-\sqrt{2}或\sqrt{14}+\sqrt{2}$