4 Replies Latest reply on Oct 25, 2006 3:30 PM by Mister Peanut

    Sparkler Effect Bombing

    MarkSLC
      Searched far and wide for a great sparkler effect, finally found one, but it is written for Flash 5, Actionscript 1.0, and I need it to work in Flash 8, Actionscript 2.0.

      The error messages I get (when I try to publish to Flash 8, AS 2) refer back to the following code. Can anybody tell me what might be causing the trouble? I am not advanced enough to know what the code is even doing (have never heard of "current" and "add current" before.)

      THANKS.
      ***********************
      temp = 1;
      while (temp <= _parent.dustinstances) {
      current = random(1000);
      duplicateMovieClip (_parent.spark, "spark" add current, current);

      if (_parent.randomrotation <> 0) {
      _parent["spark" add current]._rotation = random(_parent.randomrotation);
      } else {
      _parent["spark" add current]._rotation = _parent.rotation;
      }

      _parent["spark" add current]._x = _x;
      _parent["spark" add current]._y = _y;

      _parent["spark" add current].xspeed = (random(_parent.xspeed)-3)+1;
      _parent["spark" add current].yspeed = random(_parent.yspeed)*-1;
      _parent["spark" add current].zspeed = random(_parent.zspeed)-5;
      _parent["spark" add current].fade = random(5)+3;
      temp++;
      }
        • 1. Re: Sparkler Effect Bombing
          Level 7
          MJMalcom -

          "add" is now "+" (the plus operator, not the word "add"). This is
          probably what's causing the script errors. Also, in the case below,
          "current" is a variable, a number. It's a random number between 1 and
          1000, as defined on the third line of the script.

          MJMalcolm wrote:
          > Searched far and wide for a great sparkler effect, finally found one, but it is
          > written for Flash 5, Actionscript 1.0, and I need it to work in Flash 8,
          > Actionscript 2.0.
          >
          > The error messages I get (when I try to publish to Flash 8, AS 2) refer back
          > to the following code. Can anybody tell me what might be causing the trouble? I
          > am not advanced enough to know what the code is even doing (have never heard of
          > "current" and "add current" before.)
          >
          > THANKS.
          > ***********************
          > temp = 1;
          > while (temp <= _parent.dustinstances) {
          > current = random(1000);
          > duplicateMovieClip (_parent.spark, "spark" add current, current);
          >
          > if (_parent.randomrotation <> 0) {
          > _parent["spark" add current]._rotation = random(_parent.randomrotation);
          > } else {
          > _parent["spark" add current]._rotation = _parent.rotation;
          > }
          >
          > _parent["spark" add current]._x = _x;
          > _parent["spark" add current]._y = _y;
          >
          > _parent["spark" add current].xspeed = (random(_parent.xspeed)-3)+1;
          > _parent["spark" add current].yspeed = random(_parent.yspeed)*-1;
          > _parent["spark" add current].zspeed = random(_parent.zspeed)-5;
          > _parent["spark" add current].fade = random(5)+3;
          > temp++;
          > }
          >
          • 2. Re: Sparkler Effect Bombing
            Level 7
            Sorry - "current" will be a random number from 0 to 999.

            ImagicDigital wrote:

            > It's a random number between 1 and
            > 1000, as defined on the third line of the script.
            • 3. Re: Sparkler Effect Bombing
              MarkSLC Level 1
              Thanks ImagicDIgital--replacing 'add' with '+' allows the script to run error-free. But it's interesting, the effect doesn't look as good as the Flash 5 version. I guess I will have to figure out what other differences there are between the two versions so I can tweak the code a bit more (several assets/scripts are involved with this effect).
              • 4. Re: Sparkler Effect Bombing
                Mister Peanut Level 1
                Okay, I tried this code, and I get these errors. I am new, so I don't understand how to fix this. Any help would be great!


                **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: ')' or ',' expected
                duplicateMovieClip (_parent.spark, "spark" add current, current);

                **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: ']' expected
                _parent["spark" add current]._rotation = random(_parent.randomrotation);

                **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 8: Unexpected '}' encountered
                }