Not yet rated

Problem

There's no easy way to draw a dotted line.

Solution

Using a bitmap fill, you can at least make a horizontal line that appears dotted until something more robust comes along.

Detailed explanation

This is the same solution that I posted on my blog.

To restate here, the end goal is a divider made up of 1px dots, like this: dotted line example

My solution isn't a true line, in that you can't draw it on a diagonal. However, if you need a 1px horizontal divider, here you go. This is simply a Rect with a bitmap fill, using a dot as the bitmap. The bitmap is actually 1 pixel by 2 pixels, with the right pixel colored (#808080) and the left transparent, as such:

example of the dot png

Here's the code that would draw your "line":

<s:Rect width="500" height="1">
  <s:fill>
    <s:BitmapFill source="@Embed('/assets/images/dot.png')" fillMode="repeat"/>
  </s:fill>
</s:Rect>

That's about it. You can download the dot PNG here. Or, just make your own in Fireworks.


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes