title: Graphics - overlapping bug or what?
body: <p>I have quite a big code here... But fortunately it is not needed to be mentioned at all. It comes down to something which... fails? So, in the end this is supposed to draw two triangles (using AS3 Graphics). It works fine with one, but when I put a second there, it looks weird. I trace debugged it, and I think the bug is in the Graphics - this is my output for the actual points drawn:</p>
  
  <pre><code>DRAW
  - POINT ( 50 , -50 )
  - POINT ( -50 , 50 )
  - POINT ( 50 , 50 )
  DRAW
  - POINT ( -50 , -50 )
  - POINT ( 50 , -50 )
  - POINT ( -50 , 50 )
  </code></pre>
  
  <p>(x, y), two triangles. This would result in a square of one color (these triangles are one colored), or possibly a square split in half if I were to change the colors.</p>
  
  <p>Would... It does not.</p>
  
  <p>Instead, I get THIS:</p>
  
  <p><img src="https://i.stack.imgur.com/KO1C3.png" alt="alt text"></p>
  
  <p>OR (which is weird), when I switch the order in which the triangles are drawn:
  <img src="https://i.stack.imgur.com/T1LGk.png" alt="alt text"></p>
  
  <p>...</p>
  
  <p>Any idea what is going on?
  I have read on another forum that functions beginFill and endFill are supposed to be called before and after drawing every shape - obviously that's what I did even before looking - the color won't be different elsehow. So - any idea?</p>
  
  <p>EDIT:</p>
  
  <p>The graphics calls look like this:</p>
  
  <pre><code>for (var vi:int = 0; vi &lt; triangles.length; vi++){
      gfx.beginFill(0xFF0000, 0.5 + (0.5 * vi));
      trace("DRAW");
      trace("- POINT ( " + triangles[vi].points[0].x + " , " + triangles[vi].points[0].y + " )");
      trace("- POINT ( " + triangles[vi].points[1].x + " , " + triangles[vi].points[1].y + " )");
      trace("- POINT ( " + triangles[vi].points[2].x + " , " + triangles[vi].points[2].y + " )");
      gfx.lineTo(triangles[vi].points[0].x, triangles[vi].points[0].y);
      gfx.lineTo(triangles[vi].points[1].x, triangles[vi].points[1].y);
      gfx.lineTo(triangles[vi].points[2].x, triangles[vi].points[2].y);
      gfx.lineTo(triangles[vi].points[0].x, triangles[vi].points[0].y);
      gfx.endFill();
  }
  </code></pre>