Our dryer is located in the center of our house. The current vent situation has tubing that makes several bends between the dryer and the crawl space before hitting metal duct that takes it about 25' across the crawl space to exhaust under our deck. There are several elbows in this run. We have converted from gas heat to an electric air-to-air heat pump in recent years and have closed up exhaust flue from the old furnace that starts almost directly above where the dryer vent leaves the dryer and comes into the furnace area before going through the floor to the crawl space. If I redirect the vent up to the flue and out the roof, we'll cut a lot off the distance the air has to travel and remove most of the elbows. Is this a good idea?
I have a funny feeling that local codes might preclude it. The problem is that lint will quickly clog the vent since once any lint collects on the walls, it will slow down airflow enough that lint will accumulate at the bottom of the vent. This can cause a fire.
The dryer's installation instructions should specify maximum vertical rise of the exhaust vent. It's usually not that high, so it's unlikely your otherwise clever idea will work. If for some reason it's within spec, you'll need a different rain cap meant for dryers.
The only way you could use an existing flue for a dryer vent is if you can run a smooth 4 inch metal duct down the flue to the dryer. A masonry flue will capture lots of lint and plug up quickly, thus stopping any venting and creating a fire hazard. The previous answers give good info, a good water tight cap and vertical venting specs are important.