pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

ActionScript pastebin - collaborative debugging tool View Help


Posted by Peter Elst on Sat 4 Jul 12:18
report abuse | download | new post

  1. package {
  2.        
  3.         import flash.display.Sprite;
  4.         import flash.geom.Point;
  5.  
  6.         [SWF(backgroundColor="0xFFFFFF")]
  7.         public class CurveThroughPoints extends Sprite
  8.         {
  9.                
  10.                 public function CurveThroughPoints() {
  11.                         var pt1:Point = new Point(100, 100);
  12.                         var pt2:Point = new Point(200, 50);
  13.                         var pt3:Point = new Point(300, 100);                                                                                                                                             
  14.                         addChild(CurveThroughPoints.draw(pt1, pt2, pt3));
  15.                 }
  16.                        
  17.                 public static function draw(pt1:Point, pt2:Point, pt3:Point):Sprite
  18.                 {
  19.                         var controlX:Number = (pt2.x*2)-(pt1.x + pt3.x)/2;
  20.                         var controlY:Number = (pt2.y*2)-(pt1.y + pt3.y)/2;
  21.                         var tmp:Sprite = new Sprite();
  22.                         tmp.graphics.lineStyle(1, 0x000000);
  23.                         tmp.graphics.moveTo(pt1.x, pt1.y);
  24.                         tmp.graphics.curveTo(controlX, controlY, pt3.x, pt3.y);
  25.                         return tmp;
  26.                 }              
  27.                
  28.         }
  29. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post