1 Reply Latest reply on Mar 6, 2008 2:29 PM by Rothrock

    alpha action script error

    Ilkajb Level 1
      I would like to have several movie clips fade with action script instead of tediously tweening them all, but am having trouble. Action script is certainly not my strong point, maybe someone can spot what I am doing wrong, and explain in kindergarten terms?
      I opened a new document, created an object, turned it into a movie clip, deleted it from the stage, drug it from the library back onto the stage and named it myAlpha in the MC instance name form. It is sitting in Layer 2. Then I attached the following script.

      onClipEvent(load){
      myAlpha=0;
      this._alpha=myAlpha;
      }
      onClipEvent(enterFrame){
      if (myAlpha <=100){
      myAlpha=myAlpha +1;
      this._alpha=myAlpha;
      } else {
      stop();
      }

      However when I test the movie I always get the following errors:

      **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 5: Statement block must be terminated by '}'
      onClipEvent(enterFrame){

      **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 11: Syntax error.
      }
      Total ActionScript Errors: 2 Reported Errors: 2

        • 1. Re: alpha action script error
          Rothrock Level 5
          In kindergarten terms, start counting. Every time you see a { add one, every time you see a } subtract one. If you get to the end and the total isn't zero you have mismatched braces. Which is exactly what the error is telling you.

          In this case just add one more } to the end and they will match.