10 Replies Latest reply on Oct 4, 2006 8:48 PM by kglad

    Errors in compilation

    billywhy
      I'm a newbie in Flash.
      I met some compilation errors and hope one can help.

      I used Flash 8 professional.
      My FLA file involves a few AS files e.g. btn_Down.as. <--- Please see the code attached
      When I compiled, all the errors are concerning "ActionScript 2.0 class scripts may only define class or interface constructs."
      Please help. Thanks.

      Here are the errors:

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.val = 1;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 4: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.ovr(_root.Val);

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 6: ActionScript 2.0 class scripts may only define class or interface constructs.
      var pageWidth = 1320;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 7: ActionScript 2.0 class scripts may only define class or interface constructs.
      var pageHeight = 938;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 8: ActionScript 2.0 class scripts may only define class or interface constructs.
      var cnt:Number = 0;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 10: ActionScript 2.0 class scripts may only define class or interface constructs.
      var ratioX:Number = 0.12;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 11: ActionScript 2.0 class scripts may only define class or interface constructs.
      var ratioY:Number = 0.12;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 13: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.mouseSensor = true;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 14: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.goDest = false;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Down.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
      };

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.val = 1;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 4: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.ovr(_root.Val);

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 6: ActionScript 2.0 class scripts may only define class or interface constructs.
      var pageWidth = 1060;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 7: ActionScript 2.0 class scripts may only define class or interface constructs.
      var pageHeight = 480;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 8: ActionScript 2.0 class scripts may only define class or interface constructs.
      var cnt:Number = 0;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 10: ActionScript 2.0 class scripts may only define class or interface constructs.
      var ratioX:Number = 0.12;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 11: ActionScript 2.0 class scripts may only define class or interface constructs.
      var ratioY:Number = 0.12;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 13: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.mouseSensor = true;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 14: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.goDest = false;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_As.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
      };

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.val = 1;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 4: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.ovr(_root.Val);

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 6: ActionScript 2.0 class scripts may only define class or interface constructs.
      var pageWidth = 1320;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 7: ActionScript 2.0 class scripts may only define class or interface constructs.
      var pageHeight = 938;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 8: ActionScript 2.0 class scripts may only define class or interface constructs.
      var cnt:Number = 0;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 10: ActionScript 2.0 class scripts may only define class or interface constructs.
      var ratioX:Number = 0.12;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 11: ActionScript 2.0 class scripts may only define class or interface constructs.
      var ratioY:Number = 0.12;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 13: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.mouseSensor = true;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 14: ActionScript 2.0 class scripts may only define class or interface constructs.
      _root.goDest = false;

      **Error** C:\Documents and Settings\billy\桌面\flash_test\btn_Cust.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
      };
        • 1. Re: Errors in compilation
          Level 7

          "billywhy" <webforumsuser@macromedia.com> wrote in message
          news:efsrl8$sdh$1@forums.macromedia.com...
          > I'm a newbie in Flash.
          > I met some compilation errors and hope one can help.
          >
          > I used Flash 8 professional.
          > My FLA file involves a few AS files e.g. btn_Down.as. <--- Please see the
          > code
          > attached
          > When I compiled, all the errors are concerning "ActionScript 2.0 class
          > scripts
          > may only define class or interface constructs."
          > Please help. Thanks.

          How are you *including* the AS files?


          • 2. Re: Errors in compilation
            kglad Adobe Community Professional & MVP
            do you have a btn_Down class? or are you using an include statement to load your as file?
            • 3. Re: Errors in compilation
              billywhy Level 1
              Attached is my btn_Down.as file.
              I used an include statement to load it.
              • 4. Re: Errors in compilation
                kglad Adobe Community Professional & MVP
                show your include statement. (and you can't attach files here.)
                • 5. Re: Errors in compilation
                  billywhy Level 1
                  #include "btn_Down.as"
                  • 6. Re: Errors in compilation
                    kglad Adobe Community Professional & MVP
                    there's something other than the code you've posted here causing that problem. are you sure the code for btn_Down.as is accurately posted here?

                    is it possible that you have two btn_Down.as files in two different directories? is your flash html and swf in the same folder? if they are in different folders, are there two different btn_Down.as files in those folders?

                    if you're still having problems after reading the above, post a link to your fla and your .as file.
                    • 7. Re: Errors in compilation
                      billywhy Level 1
                      Thanks for your reply.

                      I'm sure the code is correct and there is no other btn_Down.as.

                      Is there any setting which I may neglect?
                      • 8. Re: Errors in compilation
                        AnandMX
                        I tried this code and wont find any error. it may that your .fla file has corrupted.
                        // --- btn_Down .. ------------------------------------------------------------

                        _root.val = 1;
                        _root.ovr(_root.Val);

                        var pageWidth = 1320;
                        var pageHeight = 938;
                        var cnt:Number = 0;

                        var ratioX:Number = 0.12;
                        var ratioY:Number = 0.12;

                        _root.mouseSensor = true;
                        _root.goDest = false;

                        this.btn_Down.onEnterFrame = function () {
                        trace("working ")
                        cnt++;
                        if(cnt%2 == 0) { // %翱骯濠蒂 檜辨 enterFrame擊 fps / 4
                        if (_root.mouseSensor) {
                        destX = pageWidth / 2 + (pageWidth / 2 - _xmouse) * ratioX;
                        destY = pageHeight / 1.5 + (pageHeight / 2 - _ymouse) * ratioY;

                        dX = destX - this._x;
                        dY = destY - this._y;
                        this._x = this._x + dX * 0.1;
                        this._y = this._y + dY * 0.1;
                        }

                        if (_root.goDest) {
                        dX = destX - this._x;
                        dY = destY - this._y;
                        if (Math.abs(Math.round(dX)) == 0 && Math.abs(Math.round(dY)) == 0) {
                        _root.goDest = false;
                        }
                        this._x = this._x + dX * 0.200000;
                        this._y = this._y + dY * 0.200000;
                        }
                        }
                        };

                        // ------------------------------------------------------------------------------
                        make sure your "btn_Down" is a movieClip and you are not using ";"
                        after #include "btn_Down.as"
                        • 9. Re: Errors in compilation
                          billywhy Level 1
                          Thanks for the replies from all of you.

                          To be honest, all the FLA and AS are from someone.
                          I'm sure the they are correct and it needs not to change anymore.

                          However, I need to edit some animation in the flash.
                          Unfortunately, before editing, I tried to compile but I failed.

                          Because I can't contact with that person anymore, I need to work out myself.

                          It seems something other than the FLA and AS which cause the errors.
                          Is there any procedures in compilation which I may neglect?
                          • 10. Re: Errors in compilation
                            kglad Adobe Community Professional & MVP
                            post a link to your .as and .fla files.