Benoitcn
Benoitcn

Reputation: 1

Drawing point in flash

I try to draw some points by coding. But the 1px width point seems has feature at the edge. Even I try to draw some position ten times.

This is my code:

private function createPoint(radio:Number, rep:int):Shape{
        var s:Shape = new Shape();

        var i:int = rep;
        while( i-- > 0 ){
              s.graphics.beginFill(0, 1);
              s.graphics.drawRect(0,0, radio, radio);
              s.graphics.endFill();
  }

  return s;

}

Upvotes: 0

Views: 2775

Answers (1)

Bosworth99
Bosworth99

Reputation: 4234

    private function drawPoint():void
    {
         this.addChild( createPoint(10) );
    }

    // param must be >= 1
    private function createPoint(radio:uint):Shape
    {
         var s:Shape = new Shape();
         s.graphics.beginFill(0x00ff00, 1);
         s.graphics.drawRect(0,0, radio, radio);
         s.graphics.endFill();

         return s;
     }

Will certainly work. You may not of been adding the returned shape into the display list.

Upvotes: 2

Related Questions