Quantcast
Channel: Adobe Community : Discussion List - Using Flash Builder
Viewing all articles
Browse latest Browse all 1802

Solution: paint a doted line function - 4free ^^

$
0
0

hi folks,

 

now here is a simple function to make a doted line - try it

 

"caller":   dotIt(this.container.width,100,100,"horizontal");

 

// paint a doted line
private function dotIt(length:int, startX:int, startY:int, direction:String):void
{
  var currentLength:int;
  var dotLength:int = 5;
  var paintDot:Boolean = true;

  length -= dotLength;  // no over painting
  this.container.graphics.lineStyle(0.5,this.fontColor,0.5);
  this.container.graphics.moveTo(startX,startY);
 
  for(currentLength=0; currentLength <= length; currentLength+=dotLength)
  {
   // paint dot
   if(paintDot==true)
   {
    this.container.graphics.lineStyle(0.5,this.fontColor,0.5);
    switch(direction)
    {
     case "horizontal":
      this.container.graphics.lineTo(startX+=dotLength,startY);
      break;
     case "vertical":
      this.container.graphics.lineTo(startX,startY+=dotLength);
      break;       
    }
    paintDot=false;
   }
    // paint space
   else
   {
    this.container.graphics.lineStyle(0,this.fontColor,0);
    switch(direction)
    {
     case "horizontal":
      this.container.graphics.lineTo(startX+=dotLength,startY);
      break;
     case "vertical":
      this.container.graphics.lineTo(startX,startY+=dotLength);
      break;       
    }
    paintDot=true;
   }
  }
}

 

thx4replies ^^


Viewing all articles
Browse latest Browse all 1802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>