In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Adobe Logo forked from: draw a Triangle..

use drawTriangles to draw a Triangle..
Get Adobe Flash player
by nitoyon 27 Feb 2010
    Embed
/**
 * Copyright nitoyon ( http://wonderfl.net/user/nitoyon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/pOLO
 */

// forked from mash's draw a Triangle..
// use drawTriangles to draw a Triangle..
package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
			graphics.beginFill( 0xff0000 );
			
			// 1,1,sqrt(2)
			graphics.drawTriangles( 
				Vector.<Number>([10,10, 100,10, 10,150,
			 		180,10, 270,10, 270,150,
			 		220,150, 180,90, 130,90, 170,150
			    ]), 
			    Vector.<int>([0,1,2,3,4,5,6,7,8,8,9,6])
			);

			drawTriangle( 80,120,120, 0 )
			scaleY = 1.2;
        }
        private function drawTriangle( basex :Number = 0, basey :Number = 0, length :Number = 0, rot :Number = 0 ) :void {
			// 1,2,sqrt(3)
			graphics.drawTriangles(
				Vector.<Number>([basex,
					basey, 
					basex+length,basey, 
					basex+(length/2),
					basey-Math.sqrt(3)*length/2]),
				Vector.<int>([0,1,2])
			);			

        }
    }
}