5 Replies Latest reply on Nov 2, 2006 10:10 AM by TimSymons

    can't find: '{' expected and Syntax error

    Wholeo Level 1
      I did a hover caption tutorial at ultrashock.com. Scripts work for others. When I try to publish, I get this output:

      **Error** /dailyBackup/html/caption/Library.as: Line 1: '{' expected
      class Library
            static function delegate(object:Object, methodName:String):Function
                        var method = object[methodName];
                        delete methodName;
                        var parameters = arguments.slice(2);

      **Error** /dailyBackup/html/caption/Caption.as: Line 1: Syntax error.
      import Library;
import Tween;
import easing.*;
import DropShadowFilter;

      I copied all the imported AS files from the Macromedia directories and put them in the same folder with Caption.as and Library.as and hotspot.fla.
        • 1. Re: can't find: '{' expected and Syntax error
          TimSymons Level 1
          You can't just move the libraries around like that. The class definition also contains the path and it you don't modify it then they will not load.

          You should leave them where they were and import them as:

          import mx.effects.Tween;
          import mx.transitions.easing.*;
          import flash.filters.DropShadow;


          • 2. Re: can't find: '{' expected and Syntax error
            Wholeo Level 1
            Thanks for answering. I changed it back and still get five errors. Probably it is a path problem. Where is the "base directory" (where caption.as is to be stored)? I assumed it was the top directory of my local copy of my web pages, in the caption folder. I can't see any path definition that tells the program how to find the Adobe/Macromedia files buried down in the Applications directory.
            I gave up on this, given that the output tells me there are syntax errors in the files that I copied and pasted from the tutorial site. I can't understand the path structure as communicated in the tutorial and files.
            I made buttons for mouseover captions. A workaround for now.
            • 3. Re: can't find: '{' expected and Syntax error
              TimSymons Level 1
              The Flash program has those paths hardcoded inside the program. You can add new paths to search for other classes that you create that are not located in the same folder as your FLA.

              Open the pushlish settings dialogue box, click on the Flash tab and then click on the button named "Settings...". In the box that opens, you can set new paths for the compiler to search in for classes.

              • 4. Re: can't find: '{' expected and Syntax error
                Wholeo Level 1
                I'll try again to get the linkages and settings right, thanks.
                A basic confusion for me (based on laziness on my part) is which .as scripts, if any, have to be there at runtime and which are just for the compiler. Since I didn't know, I put the caption and caption/actionscript folders on my local computer version of my website, to be published to my server.

                Also I didn't know which .as files were to go in actionscript folder. Maybe all of them.
                • 5. Re: can't find: '{' expected and Syntax error
                  TimSymons Level 1
                  Depending if you are writing a "class" or just wanting to insert common code will determine if you need the .as files at runtime or not.

                  For example, when writing a class, you have to write it in an external .as file and you only need the .as file during authoring and publishing. Once the file has been published you do not need the .as file any more. Classes are always referenced with the "import" keyword.

                  If want to include common code in your Flash file that is NOT a class, then you would use the "include" keyword. When you "include" a .as file you will have to also keep it with the published SWF file. So you would need it during authoring and at runtime.