3 Replies Latest reply on Jul 17, 2007 3:56 PM by eholz1

    Drawing a line along a tweened path

    eholz1 Level 1
      Hello Forum Group,

      I have a path that I would like to follow in a Flash application. I have a path that moves horizontally, and vertically, and a symbol (a small filled circle - as a movie clip) that tweens along the path I have drawn.
      (I am trying to show electrical current flow in a circuit). My little ball works fine.

      Then, as the ball moves along the path I would like to draw a rather broad line
      (Line.lineStyle(14,0x006600,44); along this tweened path as the ball moves over the path.

      Here is the code I use to write the line, etc. (with some lines commented out):
      var frameNumber:Number;
      var modNumber:Number;
      var constX:Number;
      var constY:Number;


      constX = 0;
      constY = 0;

      onEnterFrame = function () {
      frameNumber = this._currentframe;
      modNumber = frameNumber%2;
      //if (modNumber == 0) {
      //Line.moveTo(ball._x, ball._y);
      Line.lineTo(ball._x, ball._y);
      if (frameNumber == 7) {
      constX = ball._x;
      if (frameNumber == 16) {
      constY = ball._y;
      frameNum.text = "Frame Number: " + frameNumber + " and x: " + ball._x + " and y: " + ball._y;

      I would like to draw a little "nicer" line, with a curve at the places where x and y change. My current solution is workable but not pretty (if you know what I mean). Any suggestions on how to "draw" a nice flowing curving line that does not take hours of code? I am using Flash 8 and actionscript 2.0.