Adding the water to a pipe dream clone

Anyone remember that game where you connect pipes together and water flows through them?

Im making a clone of it in flash, using tiles. I have the basics all laid out, the generation of the tiles, laying down pipe tiles and the rest. However, I know need to add the water and have no idea how to do it!

My guess is that i need to store position of the pipes in an array, and trigger an animation of water going through the pipes when the previous pipe is full? Im not sure how I can determine which direction the water flows in, or to be honest how to call one movie to play when the previous one has finished.

Any pointers here much appreciated