Quantcast Draw Dashed Lines in Flex / AS3 | The Danosphere.

The Danosphere.

Avatar

class TheDanosphere extends Dan implements Blog

Draw Dashed Lines in Flex / AS3

Here is a recent code snippet I wrote to draw dashed lines in Actionscript (I am using it in Flex). Very cool. I’m displaying it using the new “Snipt Embed” functionality from Snipt.org, pretty neat!

Share this post with friends:
  • Twitter
  • Facebook
  • LinkedIn
  • email
  • del.icio.us
  • Digg
  • Reddit
  • Google Bookmarks
  • Mixx
  • StumbleUpon
  • Tumblr
  • I'm enjoying commenting more and more now. it's a nice pass time. I like this post. I think disqus is one demonstration as to how important commenting is.
  • Tim
    you could also use this for a horizontal dashed line (and the same for vertical but flip the x and y in the loop and moveto/lineto values)

    public function drawHorizDashedLine(startX:Number, startY:Number, endX:Number, endY:Number):void{
    var line:UIComponent = new UIComponent();
    line.graphics.lineStyle(1,0xff0000,1,false,"normal","none");
    var gap:int=6;
    for (var i:int = startX; i < endX; i = i + gap ) {
    line.graphics.moveTo( startX + i, startY);
    line.graphics.lineTo( startX + i + gap / 2, endY);
    }
    addChild(lineparent);
    }
blog comments powered by Disqus

What's Here?