views:

9

answers:

0

Hi there,

I am trying to create a dotted line (1 pixel width, 1 pixel black/3 blank alternating along the line) as the vertical separator in a datagrid. I understand that you can use a ProgrammaticSkin to create skins for Flex, but I can't seem to get it to display the line I create.

Here is my skin at the moment:

package mypackage.skins
{
 import flash.display.Bitmap;
 import flash.display.BitmapData;

 import mx.skins.ProgrammaticSkin;

 public class VerticalDottedSeparatorSkin extends ProgrammaticSkin
 {
  override protected function updateDisplayList(measuredWidth:Number, measuredHeight:Number):void
        {   
         // Measured width returns 0, so use 1 for a 1 pixel width divider?
         var w:Number = 1;
         // Measured height correctly reports the height
            var h:Number = measuredHeight;
            super.updateDisplayList(w, h);
            // SeparatorColor is set correctly, tracing here reports the correct value
            // so no problems there..
            var separatorColor:uint = getStyle("separatorColor");

            graphics.clear();
            var separatorBmpData:BitmapData = new BitmapData(w,4,true);
            separatorBmpData.setPixel(0,0,separatorColor);
            graphics.lineBitmapStyle(separatorBmpData);
            graphics.moveTo(1,0);
            graphics.lineTo(1,h);
        }
 }
}

Am I missing something obvious? It doesn't display any seperator at all at the moment..