When you swat at a child and he immediately strikes back, that is a direct response to your use of force.
Regarding running into traffic, retrieving the child from danger, holding them tightly while forcing them to look at you and telling them, "No! The street is dangerous!" and allowing them to hear the urgency in your voice is just as effective and teaches them the reason why.
Why are parents allowing their children to be so close to the street, anyhow? Aren't they supervising? I once had my 3 year old go to step off the curb at a shopping center while we were heading back to our car just a split second before me when a car came speeding around the corner. I grabbed him by the hood of his winter coat and yanked him up to safety while his little feet were still walking in the air! A stern, "No!" and hearing the fear in my voice and seeing the fear in my eyes was better than what any spanking could have done.