I could show you some test pictures about how your flash pictures can control the continuous ambient light with shutter speed, but you really need to do it and see it and believe it, to make this info be actually available to you. Please? You surely can spare five minutes for the simplest exercise?
Indoors at night (or at least in room with no bright window sunshine to confuse things at first), turn on a regular table lamp, hopefully placed within a couple of feet from a wall, to illuminate that wall. You are simply going to take a picture of that wall and that lamp, from say 8 to 10 feet away. Use any lens and zoom that shows several feet of wall width, including the lighted table lamp in the picture.
Set your cameras exposure mode to Manual M mode for this test. Your TTL flash will still give automatic flash exposure in this camera Manual mode. Repeat: Your TTL flash will still give automatic flash exposure in this camera Manual mode. Try this once so you will believe it too. No reason to be scared of Manual camera mode with flash indoors, because the TTL flash still gives automatic exposures. You still set aperture yourself, same as in camera A mode. Manual camera mode merely allows you to also specify the shutter speed which controls the ambient in the room. The ambient is near insignificant, and the flash is not a affected by shutter speed anyway. This is kind of a big deal to know, so I will repeat it one more time.
Manual mode: Think of it this way, since flash is not affected by shutter speed, then for flash, M mode is exactly the same as A mode, in that we set aperture for the flash power either way. Camera M mode is good stuff for flash indoors (but matching sunlight usually requires a correct ambient exposure). Indoors in A mode, you will simply always get 1/60 second shutter speed, which is from your cameras menu for Minimum Flash Shutter Speed. 1/60 second there only means the dim ambient was not stronger than that, so the camera enforced a minimum limit. There are reasons sometimes to use other than 1/60 second, so we might as well set shutter speed for continuous ambient to be the way we want it. M mode allows doing that. This is ALL it does in this case. The TTL flash is still automatic flash exposure, and using the aperture you set anyway, exactly like A mode in this case.
For this test, set the ISO to 200, and set the aperture to f/5.6 or f/8. Open the internal flash door, or use hot shoe flash, in TTL flash mode. Direct flash for this test, but bounce or any other flash setup works the same way.
Take a picture at say 1/30 second (M mode permits that). Include the table lamp in a picture of the wall.
Take another picture (the same picture), everything the same except at 1/200 or 1/250 second shutter (or 1/500 second on D40/D50/D70 models), or whatever fast shutter speed your camera allows as maximum shutter sync speed. Do stay OUT of FP HSS mode, we are speaking of regular flash here (no faster than maximum shutter sync speed - faster is NOT "flash").
OK, you should notice that in the slow 1/30 second picture, the table lamp (a continuous light) appears as being lighted, and it is even illuminating a little of the wall and table it sits on. It's power does not reach very far (inverse square law). We have no reason to believe our f/8 at 1/30 second was a correct exposure for the area of the ambient continuous lamp, but it should be ballpark enough to make the point of this concept. Only the flash is illuminating the farther regions of the wall. The flash exposure was correct, because the camera TTL option metered the flash and adjusted its power level automatically to be correct for the f/8 aperture which we specified. The wall illumination is NOT from the lamp or from any ceiling light. Turn the flash off and repeat the picture (will be pretty dark then) to make this point to yourself.
in the faster picture, 1/200 second or whatever, the continuous light is diminished by these 3 stops of increased shutter speed (1/30, 1/60, 1/125, 1/250 is a 3 stop change). If your results match mine, the lamp does not even appear to be turned on. The shutter speed was too fast for the degree of continuous ambient we have - the shutter speed we selected simply kept it out. But the flash illumination of the walls is unchanged from the first slow picture.
See? Shutter speed does NOT affect flash exposure, but does affect continuous light. And in such flash pictures, shutter speed is our choice, slow to allow the ambient into the picture, or fast to keep it out. This is such a biggie to know and use. A fundamental of using flash.
In a picture such as this, you may have wanted some of the ambient light to register, warm and cozy so to speak. But if a picture of a person, you don't want the incandescent light making them orange, so you probably want to keep it out. It is our easy choice, whatever you want to do. In a studio flash situation, we never want the ambient, so we use the shutter's maximum sync speed. I might mention this surely requires using the camera's Manual mode.
OK, the room with bright sunshine was mentioned at the start of the homework assignment. That sunlight is continuous too, and works the same as the table lamp, but it is likely much brighter than artificial light, with enough strength to give the flash power a real run for the money. Therefore it is much harder to simply overpower and ignore like we can the table lamp.
But you can change aperture too. If you stop down aperture, the TTL flash will have to use more power to give the same exposure, and it will (up to its power limits). But stopping down reduces the ambient too (at same shutter speed), and the ambient is unable to compensate and increase (like the flash can). So stopping down is the second level of tool to reduce the ambient light. Setting shutter to maximum sync speed is obviously the first step.
I will relent and show this, as you need to know, but you really do need to repeat it yourself. Do it! So that you can and will believe it, to enable using it. Any quick flash picture of a lighted table lamp, from not too close. This one is an ordinary incandescent 40 watt lamp, with bright sunshine outside this window. These are ISO 200.
Shutter speed affects continuous ambient like we always knew it does, but shutter speed does not affect the flash exposure. Therefore, a faster shutter speed can keep out more of the continuous ambient, or a slower shutter speed can allow more ambient light into our flash picture, without affecting the flash exposure (any flash picture is a double exposure of these two light sources). We can vary the ambient light with shutter speed, relative to the fixed flash intensity.
A tricky point, a subtle second level of control:
At the same shutter speeds in previous example, stopped down f/8 or ISO 100 would have even more effect to limit continuous ambient, with less ability to show the ambient. Or more wide f/4 or ISO 400 would allow less difference (these make insignificant ambient be more significant). Or turning flash power up stronger is of course a brute force way to make it stronger than the ambient (assuming it has power capability to do it). The TTL flash power will respond to smaller closed aperture, or to lower ISO (TTL flash power level automatically responds, or manual flash can be adjusted to respond) with greater flash power level for same picture. But the continuous ambient light cannot so respond, and is left behind, so the difference widens. Or the opposite, opening aperture, or increasing ISO causes TTL flash power to respond with lower necessary power level, but the continuous ambient does not respond, so the difference narrows, so ambient looks stronger now. Point is, this knowledge of basics is a great tool.
Note this is a picture OF THE LAMP, which is brighter and harder to handle than the light FROM THE LAMP. Sunshine is mighty bright too. So maybe not perfect, but still an awesome tool, which we need. We have at least a couple of stops of range to use for control. We could go to f/11 here to minimize the ambient even more (at maximum shutter sync speed), but aperture also affects flash power too, so another stop would need twice the flash power. But it is often a very workable choice.
This simple test (to try it and see) is just to prove that flash is NOT affected by shutter speed, but that we can use shutter speed to control the continuous ambient. If there is any question at all, then experiment a bit again, use a little different values but with the same concept in mind. Several values maybe, see how things work. For example, if you used ISO 200 f/5.6 then the fast 1/200 second picture probably can still just barely detect the lamp was on, where f/8 probably shows it dark (however I have not seen YOUR table lamp). If you used ISO 100 f/8, the 1/30 second picture may not be very impressively illuminated by the lamp. However I am not trying to discuss any specific table lamp or ISO, but only the general concept. Explore the situation though, and you should see the obvious control that you have. It is very useful.
Here is another try (daylight is continuous too). Approaching sunset, looking east. Bright area in window upper left is a neighbors roof in direct sun, behind a winter bare bush. These are ISO 400.
The flash illumination is the same, unaffected by shutter speed. In flash pictures, shutter speed is merely a choice to keep the continuous ambient light out, or to allow it in, but without affecting the flash exposure. We can use that. This is a N:Vision CFL lamp (camera left, green), and a GE Reveal ("daylight") incandescent lamp (camera right, red). Neither are ordinary incandescent lamps, but of course, both are continuous (however see more details about fluorescents).
So shutter speed is a control to change the ratio between continuous ambient and flash. Sometimes we may prefer the "look" of the slower shutter to capture more continuous ambient. Me too, sometimes, it can be a warmer tone. But there are cases (especially in studio photography, or high speed flash photography) when all ambient is unwanted, and we need to know that maximum shutter sync speed is the major tool to keep it out. We have the choice, and this one is easy, because it does not affect the flash (and narrow aperture and/or low ISO increase that difference, if we can turn the flash power back up).
One last point and you've got it. If the ambient is dark (a black picture if flash is not used) then it simply does not matter to anyone what shutter speed is (no ambient to register). See this link for a sample of high speed photography, where the shutter speed was BULB, manually opened and closed, typically at least 1.5 seconds. The room was dark at f/16, even if there was a table lamp turned on for humans to see. F/16 was to keep out ambient, and for closeup depth of field. Bulb and 1.5 second shutter is quite slow, but the speed of the flash duration is what stopped the action, not the shutter speed (assuming insignificant continuous ambient. The ambient COULD blur what the fast flash stopped, if allowed). Speedlights are named speedlights because they are incredibly fast at lower power levels. Shutters are simply never that fast, unsuitable for high speed photography.