Why stop at a rectangle when the same method can be used to draw animated lines in any angle? So here is a Marching Ants Path class - I don't know if it's of any use - maybe for a lasso tool of some upcoming Flash based "Photoshop Junior" RIA?
BTW - the hardest part was to make the bitmaps line up correctly so that the patterns are moving somehow in sync. There is some under-the-hood stuff going on with beginBitmapFill that I haven't yet fully figured out. It seems like the fill bitmaps get aligned to 0/0, but when they are flipped they don't. Or do they?
Whatever, the current version uses a mixture of try-and-error plus in-theory-this-should-work algorithms and funny enough this seems to work well with short, curvy pathes and a little less well with long straight line segments. But you can see that anyway only with the "long" setting in the demo.
Have you noticed that the lines in photoshop look more like a 1px stroke around the area which is used as a mask to show more of a scrolling bitmap that has black and white lines at 45 degrees which is scrolling at 45 degrees? (if you can understand?) Because the line is always 0 degrees or 90 degrees (pixels are always square) you never really see a solid line. but this Version could work well for vector stuff as well :o)
I've noticed the flipped bitmap 1 px shift phenomenon(!) aswell. I found this in Flash 6 when when I was flipping an imported bitmap. I noticed that it only occurs when the width of the bitmap is an odd number! So I exported all bitmaps with rounded dimensions eg 120x120.