The question is not as simple as it may seem.
For one thing, it is not certain which of the fossils that we have found so far were merely insect-like or spider-like, or which would be regarded as definite insects or spiders today. Some insect-like and spider-like fossils date back something like 350 to 400 million years ago, back in the Devonian. Something like 100 Million years later, in the Carboniferous, there certainly were unmistakable insects, and spiders as well, but when spiders started spinning web traps is not so clear. Some webs have been found about 150 Million years old or so, but that is quite a lot younger than the oldest spider-like fossils.
Another question is whether you mean "flies" or "insects in general" and whether you mean "Diptera" or "houseflies" (Muscidae). The earliest fossil insects found were similar to our "silver fish", but there is no real clarity. The best fossils are in amber, but there is little good amber older than about 150 million years, though a little of it dates back about twice as far as that.
Anyway, undoubted fly fossils (Diptera) only date back some 200 million years; flies are fairly "advanced" insects in evolutionary terms. So you can be pretty sure that the spiders were around in easily recognisable form for more than 100 million years before there were true flies.
On the other hand, we can be reasonalby sure that many families of web spinners, such as spiders that spin orb webs, only evolved after flying prey emerged, though webs for catching crawling prey would have emerged many millions of years earlier.
Short answer: First spiders, then flying insects, then orb webs.
Longer answer: Loooots yet to discover! Looooooots of work to do. That's the way these things go.
Go well,
Jon