Marching ants rectangles are probably not priority #1 in an application, but they are a nice visual clue to the user that she is currently opening a selection rect. So if you are still looking for a nice "pimp up your app" part, look no further:
This an example for a very simple visual widget that you could also build with the Flash Drawing API, where it would proably become a horrible performance hog having to draw hundreds of tiny vectors. Using the new beginBitmapFill method this tool behaves much nicer and has a very small footprint.
The class allows for custom line patterns and colors and you can change the speed and direction of the ants' march.
Native dotted lines with lineTo/lineStyle? Then you know more than I do, John. To my knowledge this is not supported yet. The only new properties of lineStyle are: pixelHinting, noScale, capsStyle, jointStyle and miterLimit.
Shirley - of course it's only the frame that I'm rendering. How should I know in which environment it will be used? What belongs into the selection in the respective app? It could be a bitmap, some movieclips, text, just anything. So for me it doesn't make sense to include that in this class. The frame is just a nice eyecandy, the other part has to be done by the programmer.
I cannot say that for sure, but I think that this an optical illusion. One way to test that is to draw a very thin tall rectangle and compare the short edge to the long edge. They definitely move in the same speed, but the shorter one looks faster.
If you find it is better suited for your purposes and think it is simpler that's perfectly fine.
Personally I prefer to have something like this neatly packaged in a class, so to me my version looks actually simpler. Plus it allows you to define your line pattern in Actionscript and not by loading a bitmap. And it doesn't run on onEnterFrame. And even if most people probably don't care - my ants run around in a perfect cycle and not crisscross.
I prefer the neat packaging as well, though for those examples I tried to keep the required level of knowledge to a minimum so that more people would be able to learn from them without the requirements of knowing AS2 etc. That marquee also mimics the photoshop marquee instead of following the direction of the line.
The line speed change is an illusion. you can test it by dragging the rectange from being a square to being a tall thing rectangle. if the "ants" were fast the shorter it got, you would see them speed up. but you don't. the illusion happens are the ants make a short trek from corner to corner in a couple blinks, which out eyes misinterpret as a faster speed, incorrectly.
My family name is written Klingemann,
not Klingelmann, Klingeman, Klingaman, Kingemann,
Kindermann, Killingaman, Klingman, Klingmann, Klingonman
Klingemman, Cleangerman, Klingerman or Kleangerman