4 Replies Latest reply on Feb 9, 2010 4:38 PM by kglad

    Issues with conflicting AS2 scripts

    Atomic Katz

      So I am building my first Flash website (Yay!). There are two effects that I enjoy having as part of the experience. One is a text based mouse trial. the other is vibrating dot that also randomly populates the screen based on predefined. The only similarity between the two scripts is the use of "MovieClip" or a variation of it. In the end, I cannot use both at the same time. Can anyone suggest a solution? I would greatly appreciate it!

       

      Mouse Trail Code:

       

      Text = "Blah Blah Blah";
      letters = Text.split("");
      //Format1
      fontformat = new TextFormat();
      fontformat.font = "Verdana";
      fontformat.align = "center";
      fontformat.size = "10";
      fontformat.color = "0xFFFFFF";
      fontformat.bold=true;
      //format2
      fontformat1 = new TextFormat();
      fontformat1.font = "Verdana";
      fontformat1.align = "center";
      fontformat1.size = "10";
      fontformat1.color = "0xFFFFFF";
      fontformat1.bold=true;
      spacing = 6;
      speed = 3;
      for (var LTR = 0; LTR<letters.length; LTR++) {
          mc = _root.createEmptyMovieClip("l"+LTR, LTR);
          mc.createTextField("t"+letters[LTR], LTR, LTR*spacing, 10, 20, 20);
          with (mc["t"+letters[LTR]]) {
              trace(LTR);
             
              text = letters[LTR];
              //for first 7 characters
              if(LTR<7)
              {
              setTextFormat(fontformat);
              }
              //for after 7 characters
              else
              {
                  setTextFormat(fontformat1);
              }
              selectable = false;
          }
          if (LTR) {
              mc.prevClip = _root["l"+(LTR-1)];
              mc.onEnterFrame = function() {
                  this._x = this._x+(this.prevClip._x-this._x+5)/speed;
                  this._y = this._y+(this.prevClip._y-this._y)/speed;
              };
          } else {
              mc.onEnterFrame = function() {
                  this._x = this._x+(_root._xmouse-this._x+10)/speed;
                  this._y = this._y+(_root._ymouse-this._y)/speed;
              };
          }
      }

       

       

      Vibrating Dots Code:

       

      onClipEvent (load) {
          //movie width/height
          height = 200;
          width = 300;
          //------------------------//
          //makes everything random //
          //------------------------//
          this._x = Math.round(Math.random()*width);
          this._y = Math.round(Math.random()*height);
          var temp = this._alpha=Math.random()*100;
          this._xscale = this._yscale=temp;
          //setting initiaion position
          cx = this._x;
          cy = this._y;
      }
      onClipEvent (enterFrame) {
          //causes the object to be offset
          this._x = cx+(1+Math.random()*5);
          this._y = cy+(1+Math.random()*5);
      }

       

      Duplication and population:

       

      for (var i = 0; i<25; i++) {
          circle.duplicateMovieClip(i, i);
      }