On the Geometric Interpretation of the Local Criterion for Flatness

The local criterion for flatness goes this way:

Let $\phi : (A,m)\rightarrow (B,m')$ be a local morphism of local Noetherian rings, and $M$ a finitely generated $B$-module. If $x\in m$ is a non zero-divisor on $M$ then $M$ is flat over $A$ iff $M/xM$ is flat over $A/xA$.

One usual geometric interpretation (see for instance Eisenbud, Commutative Algebra with a View towards Algebraic Geometry, chapter 6.4) is:

If we have a morphism of affine varieties $X\rightarrow Y$ over $\mathbb{A}^1$ such that the maps to $\mathbb{A}^1$ are flat and dominant, for any point $p$ in $\mathbb{A}^1$ choose a point $p'$ in $Y$ above $p$ and a point $p''$ in $X$ above $p'$. If the map of fibers $X_{p}\rightarrow Y_{p}$ is flat in a neighborhood of $p''$ in $X_{p}$, then the map $X\rightarrow Y$ is also flat in a neighborhood of $p''$ in $X$.

I fail to see the obviousness of this interpretation: does this mean that if $R$ and $S$ are the respective affine rings defining the affine varieties $Y$ and $X$ over the field $k$, if $P'$ and $P''$ are the maximal ideals defining the points $p'$ and $p''$, if we have $S_{P''}$ flat over $R_{P'}$, there exist an element $f''$ of $S$ not contained in $P''$ such that $S_{f''}$ is flat above $R$?

I mean that using the local criterion for flatness I see how I can get the flatness of the rings localized at maximal ideals coming from the flatness on the fibers, but how to extend it to a neighborhood of each points ?

Edit: after re-reading the clear answer from Akhil Mathew, I cannot help but wondering if there is a way to get the geometric interpretation of Eisenbud without using the result on the open locus for flat maps which is above the level of chapter 6 of Eisenbud classical book. Can somebody enlighten me here?

Edit2: an interesting thread on Math.SE which gave me all the answers I needed using generic flatness instead https://math.stackexchange.com/a/2321347/14860

Also, this particular result is true more generally: if $f: X \to Y$ is a morphism of finite type $S$-schemes ($S$ being noetherian), and if $X, Y$ are flat, then $f$ is flat if and only if each of the maps $f_s: X_s \to Y_s$ are flat. This follows from the fact that one direction of the local criterion of flatness is true under more generality: that is, if $B \to C$ is a morphism of local noetherian rings both local and flat over the local noetherian ring $(A, \mathfrak{m})$, then $B \to C$ is flat if and only if the fiber $B/\mathfrak{m} B \to C/\mathfrak{m}C$ is flat. See for instance Proposition 4.10 of this document.
• @Akhil Mathew Thank you very much for this very clear answer, and especially the generalization of the local criterion for flatness. In any case, you did confirm me that this geometric interpretation is not completely obvious : the result of EGA IV-3, 11.1.1 is necessary to get flatness in a neighborhood of $p''$, and it was not mentioned at all in Eisenbud, Commutative Algebra, 6.4., neither in most places where this interpretation is given, perhaps because the fact that the set of points where flatness occurs is open is such a well known fact ... – brunoh Jun 11 '12 at 7:34