Let $f:[a,b] \to \mathbb{R}$ be a bounded function. Define $A_{f,x} : (0, \infty) \to \mathbb{R}$ by $$A_{f,x} (r) = \text{diam}\left( f((x-r,x+r) \cap [a,b])\right).$$ Prove that $f$ is continuous at $x$ if and only if $\lim_{r\to 0^+} A_{f,x} (r)= 0$.
For background, I am currently working through the integration chapter of baby Rudin's Analysis. My starting point to the proof is showing that $\lim_{r\to 0^+} A_{f,x} (r) $ exists for every $x\in [a,b].$ If this is the correct approach, how can we show this limit exists and conclude the proof? Below is the definition of diam.
Definition:
Let $E$ be a nonempty subset of a metric space $X$ and let $S = \{ d(p,q) \in \mathbb{R} : p\in E , q\in E \}$. Then $\text{diam} (E) = \sup S$.
Sketch of Proof
($\Rightarrow$) For simplicity, let us assume $x \in (a, b)$. Next, assume $f$ is continuous at $x$. Choose $r$ such that $(x-r, x+r) \subset (a, b)$. Then we see that \begin{align} A_{f, x}(r) =&\ \operatorname{diam}[f((x-r, x+r))] = \max_{u, v \in (x-r, x+r)}|f(u)-f(v)|\\ \leq&\ \max_{u \in (x-r, x+r)}|f(u)-f(x)|+\max_{v \in (x-r, x+r)}|f(x)-f(v)|. \end{align} Using continuity of $f$ at $x$ you can show that $A_{f, x}(r)\rightarrow 0$ as $r\rightarrow 0^+$.
Note: Try to see where I used the fact that $f$ is bounded.
($\Leftarrow$) Suppose $A_{f, x}(r) \rightarrow 0$ as $r\rightarrow 0^+$. This follows immediately from the definition $A_{f,x}$ given by the max of the difference.