October 06, 2005
Flash 8: Marching Ants Path

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.

Download the Marching Ants Path source here.

Posted at October 06, 2005 02:26 AM | Further reading

As usual, Mario comes up with another rad prototype.

Posted by: Daniel Wabyick on October 6, 2005 04:15 AM

Wicked. Well done.

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)

Posted by: Campbell on October 6, 2005 04:39 AM

Just set your textfield's autoSize property to "left" before you fill it with the text.

Posted by: Mario Klingemann on November 6, 2005 12:41 AM

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.

You can see the project here: http://www.empiresq.com/builder/
I needed all the pixels to line up perfectly.

Posted by: Ultraniblet on November 23, 2005 11:19 AM


Posted by: نااال بيي on December 2, 2005 12:33 AM
Post a comment

Email Address:



Remember info?

Thank you!

Most Visited Entries
Sketches, Works & Source Code
In Love with
Powered by
Movable Type 2.661

© Copyright Mario Klingemann

Syndicate this site:
RSS 1.0 - RSS 2.0

Quasimondo @ flickr
Quasimondo @ LinkedIn
Quasimondo @ Twitter
Quasimondo @ Facebook
Quasimondo @ MySpace
Quasimondo is a Bright
Citizen of the TRansnational Republic
My other blog in german

My family name is written Klingemann,
not Klingelmann, Klingeman, Klingaman, Kingemann,
Kindermann, Killingaman, Klingman, Klingmann, Klingonman
Klingemman, Cleangerman, Klingerman or Kleangerman

profile for Quasimondo at Stack Overflow, Q&A for professional and enthusiast programmers