I was reading about special relativity and the book derives the time dilation formula using the thought experiment in which a flash of light is emitted inside a moving train car - it proceeds to go up to the ceiling, hit a mirror, and come back to the place where it was emitted (where it is detected). Using the constancy of $c$ they derive that the time between emission and detection would be measured in the ground frame $S$ as $\Delta t = \gamma\times \Delta t'$, where $\Delta t'$ is the time measured inside the train car.
Then they go on to derive length contraction using this formula for time dilation - the length of the car is measured by somebody in the ground frame as $l=V\Delta t$, where $\Delta t$ is the time between the two events:
front of train car in front of observer in $S$
rear of train car in front of observer in $S$
Also, two obervers at the front and back of the train record the times when they are looking right at the person standing at the ground, and find the difference, which is $\Delta t'$. Since the two events happen at the same place in frame $S$, $\Delta t$ is the proper time and $\Delta t'=\gamma\Delta t$, so $l'=V\Delta t'=v\gamma\Delta t=\gamma l$.
I am fine with all of that, but then they go on to derive the Lorentz transformation using the example of a firecracker going off in a moving train. The clocks in $S$ and $S'$ are synced when the origins coincide, and the bomb goes off a bit later as the train is speeding away to the "right" at speed $v$. The coordinates of the event in the two frames are $(x,y,z,t),(x',y',z',t')$. Using the length contraction formula they find that $x-vt=x'/\gamma\Rightarrow x'=\gamma(x-vt)$ and then, switching primed and unprimed variables and reversing $v$, they find that $x=\gamma(x'+vt')$ and solve the two equations for $t'$, giving $t'=\gamma(t-vx/c^2)$.
OK. But what I do not get here is why not just use the time dilation formula from before??? E.g., why is the answer for $t'$ not simply $t'=t/\gamma$??