Maximum brush size in Flash
I’ve been having a lot of trouble with Flash recently. This weekend, I discovered a line size limitation that doesn’t seem to be documented anywhere. Unfortunately, my.netsketchapp.com was already live and people’s drawings were being rendered incorrectly. The goal was to create an online Flash viewer that replicated the behavior of NetSketch on the iPod. The iPod app supports infinite pan and zoom, and often it’s not possible to render things to a jpg. It’s just not the same. I wrote a small flash “viewer” that loads an XML version of the drawing and allows you to pan and zoom through the drawing the same way you do on the iPod.
Here’s a sample of the Flash viewer:
The problem is, lineStyle() in ActionScript 2.0 will only let you make lines with a stroke width less than 235. Yes… 235. I have no idea why, but I tested at increments of 5 and after 235 the line just stops getting bigger. In other words, these two statements produce the same result:
line.lineStyle(235, color, 100, false, "normal", "round","round", 2); line.lineStyle(300, color, 100, false, "normal", "round","round", 2);
The fix turned out to be pretty easy. There’s a backend application that converts NetSketch’s binary vector format into XML, and I added another pass to the conversion process that scaled the drawing so all the strokes were thinner than 235pt… I was already doing some processing to fit the drawings within an Illustrator compatible EPS document (maximum size of 16383 x 16383). Still, it’s frustrating that Flash has such odd limitations. I haven’t experimented much with ActionScript 3.0, and I’m hoping that may resolve some of these things…