Rosin is an awesome substitute. As you probably know, flux is usually a mixture that rosin is as the main component, which is an auxiliary material to ensure the smooth progress of the welding process and whose main component is C20H3002.
Exactly speaking,
Flux: A chemical that helps and promotes the soldering process while protecting and preventing oxidation.
Functions: auxiliary heat conduction, oxide removal and reducing the surface tension of the material being welded.
BTW, with the soldering iron to solder the electronic components, we don’t need a separate flux because the solder wire has rosin inside.