1 Reply Latest reply on Jan 25, 2008 11:24 AM by Newsgroup_User

    How to draw lines dynamically?

    Grauzone
      Hello,

      I have a problem with drawing lines which are connected with dots.

      Thats not working ... the statement moveTo is undefined? Has someone an idea whats wrong?

      Ive Posted the Code for you...

      Thanks a lot for your replay!


        • 1. Re: How to draw lines dynamically?
          Level 7
          Hi Grauzone,

          I believe "moveTo" is undefined because the clip you are targetting is
          undefined. Trace this[linie+i] and see if it's a Movie Clip instance. I
          think you'll find your answer there.

          Regards,
          Patrick Bay
          BAY NEW MEDIA

          "Grauzone" <webforumsuser@macromedia.com> wrote in message
          news:fnd081$g1b$1@forums.macromedia.com...
          > Hello,
          >
          > I have a problem with drawing lines which are connected with dots.
          >
          > Thats not working ... the statement moveTo is undefined? Has someone an
          > idea
          > whats wrong?
          >
          > Ive Posted the Code for you...
          >
          > Thanks a lot for your replay!
          >
          >
          >
          >
          > var Data:Array = new Array(2.3,5.1,3.4,2.7);
          >
          >
          >
          > function init(kreis:String, linie:String, colorLine, colorDot,
          > Darray:Array) {
          > var total = Darray.length;
          > for (var i:Number = 0; i<total; i++) {
          > this.createEmptyMovieClip(linie+i, this.getNextHighestDepth());
          > this.attachMovie("punkt", kreis+i, this.getNextHighestDepth());
          > var mc:MovieClip = this[kreis+""+i];
          > var my_color:Color = new Color(mc);
          > my_color.setRGB(colorDot);
          > mc._x = (52*i)+54;
          > mc._y = 375-(Darray *4);
          >
          > this[linie+i].clear();
          > this[linie+i].lineStyle(3, 0xFFD836);
          > this[linie+i].moveTo(this[kreis+(i+1)]._x, this[kreis+(i+1)]._y);
          > this[linie+i].lineTo(this[kreis+i]._x, this[kreis+i]._y);
          >
          > }
          > }
          >
          > init("Dot", "Line", 0xFFEC9B, 0xFFD836, Data);
          >