To factor $ ax-2a+4x-8 $ we can use factoring by grouping.
Group $ \color{blue}{ ax }$ with $ \color{blue}{ -2a }$ and $ \color{red}{ 4x }$ with $ \color{red}{ -8 }$ then factor each group.
$$ \begin{aligned} ax-2a+4x-8 &= ( \color{blue}{ ax-2a } ) + ( \color{red}{ 4x-8 }) = \\ &= \color{blue}{ a( x-2 )} + \color{red}{ 4( x-2 ) } = \\ &= (a+4)(x-2) \end{aligned} $$