0 Replies Latest reply on Jun 17, 2007 7:50 PM by dnawo

    A Function in Flash 8 help file should be changed

    dnawo
      At curveTo Function,there is an example how to create a circle by ActionScript:

      quote:


      this.createEmptyMovieClip("circle2_mc", 2);
      circle2_mc.lineStyle(0, 0x000000);
      drawCircle(circle2_mc, 100, 100, 100);
      function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
      mc.moveTo(x+r, y);
      mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
      mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
      mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
      mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
      mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
      mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
      mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
      mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
      }



      should be changed:

      this.createEmptyMovieClip("circle2_mc", 2);
      circle2_mc.lineStyle(0, 0x000000);
      drawCircle(circle2_mc, 100, 100, 100);
      function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
      mc.moveTo(x+r, y);
      mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math. cos(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
      mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
      mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math. cos(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
      mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
      mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math. cos(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
      mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
      mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math. cos(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
      mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
      }

      Related Photo: http://www.mzwu.com/pic/20070618/001.gif