7 Replies Latest reply on Dec 17, 2006 9:02 AM by Newsgroup_User

    Actionscript Newbie

    Level 7
      Dear All

      I have downloaded an fla file that mimics the Matrix text affect you see in
      the film of the same name. I get the following error on the line "fade add i
      add .font.letterfield = substring (line1,i,1)":

      **Error** Scene=Page 1, layer=Scripts27, frame=7:Line 19: Operator 'add'
      must be followed by an operand fade add i add .font.letterfield = substring
      (line1,i,1)

      I have looked into this issue and I partially understand the problem, but I
      would not know where to start. I have attached the full frame code and I
      would appreciate any feedback from the group.

      Thanks again...

      Alastair MacFarlane

      kerning = kerningbasis * s1 / 100
      kerningvar = s1 / 100
      if (1 < line1.length) {
      gotoAndPlay(7)
      } else {
      gotoAndPlay(6)
      }
      setProperty ("letter",_y,yposstart)
      setProperty ("letter",_yscale,s1)
      setProperty ("letter",_xscale,s1)
      setProperty ("letter",_visible,false)
      if (i < line1.length + 1) {
      duplicateMovieClip ("fade",fade add i,200 - i)
      fade add i add .font.letterfield = substring (line1,i,1)
      randy = random(300) - random(300)
      scaley = random(100) - random(100)
      setProperty (fade add i,_y,yposstart)
      setProperty (fade add i,_x,xposstart + i * kerning + rand)
      setProperty (fade add i,_yscale,scaley)
      setProperty (fade add i,_xscale,s1)
      }
      duplicateMovieClip ("letter",lettera add i,i)
      lettera add add .font.letterfield = substring (line1,i,1)
      setProperty (lettera add i,_x,xposstart + i * kerning)
      i = i + 1
      if (eval("lettera" + line1.length)._currentframe == 85) {
      gotoAndPlay(9)
      }


        • 1. Re: Actionscript Newbie
          Level 7
          Alastair,

          > I get the following error on the line "fade add i add
          > .font.letterfield = substring (line1,i,1)":

          Well, that's close. There is that an operand is missing.

          > **Error** Scene=Page 1, layer=Scripts27, frame=7:Line
          > 19: Operator 'add'
          > must be followed by an operand fade add i add
          > .font.letterfield = substring (line1,i,1)

          It add operator is a very, very old one (only for strings, not numbers);
          in fact, it was deprecated back in Flash 5, and Flash Player 8 doesn't even
          support it anymore. Replace add with the addition operator (+), and see if
          your problem magically goes away.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Actionscript Newbie
            Level 7
            David,

            Thanks for the reply. I have made the alteration to the old and operator
            with a (+), but whith no effect, Flash 8 still says:

            **Error** Scene=Page 1, layer=Scripts27, frame=7:Line 19: Operator '+' must
            be followed by an operand
            fade + i + .font.letterfield = substring (line1,i,1)

            Thanks again for your support.

            Alastair MacFarlane


            The code in Frame 7 is:

            kerning = kerningbasis * s1 / 100
            kerningvar = s1 / 100
            if (1 < line1.length) {
            gotoAndPlay(7)
            } else {
            gotoAndPlay(6)
            }
            if (playsound eq "") {
            soundholder.gotoAndPlay(2)
            playsound = "1"
            }
            setProperty ("letter",_y,yposstart)
            setProperty ("letter",_yscale,s1)
            setProperty ("letter",_xscale,s1)
            setProperty ("letter",_visible,false)
            if (i < line1.length + 1) {
            duplicateMovieClip ("fade",fade + i,200 - i)
            fade + i + .font.letterfield = substring (line1,i,1)
            randy = random(300) - random(300)
            scaley = random(100) - random(100)
            setProperty (fade + i,_y,yposstart)
            setProperty (fade + i,_x,xposstart + i * kerning + rand)
            setProperty (fade + i,_yscale,scaley)
            setProperty (fade + i,_xscale,s1)
            }
            duplicateMovieClip ("letter",lettera + i,i)
            lettera + i + .font.letterfield = substring (line1,i,1)
            setProperty (lettera + i,_x,xposstart + i * kerning)
            i = i + 1
            if (eval("lettera" + line1.length)._currentframe == 85) {
            gotoAndPlay(9)
            }


            "David Stiller" <stiller-NO-SPAM-@quip.net> wrote in message
            news:em1kam$71d$1@forums.macromedia.com...
            > Alastair,
            >
            >> I get the following error on the line "fade add i add
            >> .font.letterfield = substring (line1,i,1)":
            >
            > Well, that's close. There is that an operand is missing.
            >
            >> **Error** Scene=Page 1, layer=Scripts27, frame=7:Line
            >> 19: Operator 'add'
            >> must be followed by an operand fade add i add
            >> .font.letterfield = substring (line1,i,1)
            >
            > It add operator is a very, very old one (only for strings, not
            > numbers); in fact, it was deprecated back in Flash 5, and Flash Player 8
            > doesn't even support it anymore. Replace add with the addition operator
            > (+), and see if your problem magically goes away.
            >
            >
            > David Stiller
            > Adobe Community Expert
            > Dev blog, http://www.quip.net/blog/
            > "Luck is the residue of good design."
            >


            • 3. Re: Actionscript Newbie
              Level 7
              All

              What seemed to work was to use the eval function, but I am still not sure
              why!?

              eval("fade" + i + ".font.letterfield") = substring(line1, i, 1);

              Thanks again

              Alastair


              "Alastair MacFarlane" <anonymous@macromedia.com> wrote in message
              news:em23um$nbs$1@forums.macromedia.com...
              > David,
              >
              > Thanks for the reply. I have made the alteration to the old and operator
              > with a (+), but whith no effect, Flash 8 still says:
              >
              > **Error** Scene=Page 1, layer=Scripts27, frame=7:Line 19: Operator '+'
              > must be followed by an operand
              > fade + i + .font.letterfield = substring (line1,i,1)
              >
              > Thanks again for your support.
              >
              > Alastair MacFarlane
              >
              >
              > The code in Frame 7 is:
              >
              > kerning = kerningbasis * s1 / 100
              > kerningvar = s1 / 100
              > if (1 < line1.length) {
              > gotoAndPlay(7)
              > } else {
              > gotoAndPlay(6)
              > }
              > if (playsound eq "") {
              > soundholder.gotoAndPlay(2)
              > playsound = "1"
              > }
              > setProperty ("letter",_y,yposstart)
              > setProperty ("letter",_yscale,s1)
              > setProperty ("letter",_xscale,s1)
              > setProperty ("letter",_visible,false)
              > if (i < line1.length + 1) {
              > duplicateMovieClip ("fade",fade + i,200 - i)
              > fade + i + .font.letterfield = substring (line1,i,1)
              > randy = random(300) - random(300)
              > scaley = random(100) - random(100)
              > setProperty (fade + i,_y,yposstart)
              > setProperty (fade + i,_x,xposstart + i * kerning + rand)
              > setProperty (fade + i,_yscale,scaley)
              > setProperty (fade + i,_xscale,s1)
              > }
              > duplicateMovieClip ("letter",lettera + i,i)
              > lettera + i + .font.letterfield = substring (line1,i,1)
              > setProperty (lettera + i,_x,xposstart + i * kerning)
              > i = i + 1
              > if (eval("lettera" + line1.length)._currentframe == 85) {
              > gotoAndPlay(9)
              > }
              >
              >
              > "David Stiller" <stiller-NO-SPAM-@quip.net> wrote in message
              > news:em1kam$71d$1@forums.macromedia.com...
              >> Alastair,
              >>
              >>> I get the following error on the line "fade add i add
              >>> .font.letterfield = substring (line1,i,1)":
              >>
              >> Well, that's close. There is that an operand is missing.
              >>
              >>> **Error** Scene=Page 1, layer=Scripts27, frame=7:Line
              >>> 19: Operator 'add'
              >>> must be followed by an operand fade add i add
              >>> .font.letterfield = substring (line1,i,1)
              >>
              >> It add operator is a very, very old one (only for strings, not
              >> numbers); in fact, it was deprecated back in Flash 5, and Flash Player 8
              >> doesn't even support it anymore. Replace add with the addition operator
              >> (+), and see if your problem magically goes away.
              >>
              >>
              >> David Stiller
              >> Adobe Community Expert
              >> Dev blog, http://www.quip.net/blog/
              >> "Luck is the residue of good design."
              >>
              >
              >


              • 4. Re: Actionscript Newbie
                Level 7
                >>fade + i + .font.letterfield = substring (line1,i,1)

                You get the 'Operator '+' must be followed by an operand' error because you
                have a . after the + operator and not a variable, or string.

                >>duplicateMovieClip ("fade",fade + i,200 - i)
                >>fade + i + .font.letterfield = substring (line1,i,1)

                You don't need eval. You _could_ do it like so with bracket notation:

                duplicateMovieClip ("fade",fade + i,200 - i)
                this["fade" + i].font.letterfield = substring (line1,i,1)

                However, if you look at the Help for duplicateMovieClip, you will see that
                it returns a reference to the newly created clip. So, you can simply store
                the return in a variable:

                var newClip = duplicateMovieClip ("fade",fade + i,200 - i)
                newClip.font.letterfield = substring (line1,i,1)



                --
                Dave -
                Head Developer
                www.blurredistinction.com
                Adobe Community Expert
                http://www.adobe.com/communities/experts/


                • 5. Re: Actionscript Newbie
                  Level 7
                  One more thing - you'll have the same problem here:


                  --
                  Dave -
                  Head Developer
                  www.blurredistinction.com
                  Adobe Community Expert
                  http://www.adobe.com/communities/experts/


                  • 6. Re: Actionscript Newbie
                    Level 7
                    Hate when I do that.

                    You'll have the same problem here:

                    setProperty (fade + i,_y,yposstart)

                    Use the variable you stored the reference in, and don't use setProperty...
                    it's old and ugly.

                    newClip._y = yposstart;

                    And not to be picky or anything, but using camel case makes for easier
                    reading:

                    yPosStart as opposed to yposstart


                    --
                    Dave -
                    Head Developer
                    www.blurredistinction.com
                    Adobe Community Expert
                    http://www.adobe.com/communities/experts/


                    • 7. Re: Actionscript Newbie
                      Level 7
                      DMennenoh,

                      Thanks for the information. One day I will master this script. I am of a VB
                      background so I look at the code rather quizzically. I appreciate your
                      support.

                      Alastair

                      "DMennenoh **AdobeCommunityExpert**" <dave@blurredistinction.com> wrote in
                      message news:em3eou$8cm$1@forums.macromedia.com...
                      > Hate when I do that.
                      >
                      > You'll have the same problem here:
                      >
                      > setProperty (fade + i,_y,yposstart)
                      >
                      > Use the variable you stored the reference in, and don't use setProperty...
                      > it's old and ugly.
                      >
                      > newClip._y = yposstart;
                      >
                      > And not to be picky or anything, but using camel case makes for easier
                      > reading:
                      >
                      > yPosStart as opposed to yposstart
                      >
                      >
                      > --
                      > Dave -
                      > Head Developer
                      > www.blurredistinction.com
                      > Adobe Community Expert
                      > http://www.adobe.com/communities/experts/
                      >