11 Replies Latest reply on Sep 23, 2006 4:49 PM by kglad

    Syntax Recommendation

    NetBossUSA
      I know that practice, time and hard work is what is best for learning syntax for any language but I was wondering until time, practice and hard work kicks in where is the best place to look up the proper syntax for various statements.

      When I say best place I mean one that would be easy to search and would yield the answer quickly. I can find the right syntax here and on the LiveDocs area but I'm wondering if the folks here with more experience have a prefered way of looking up the proper syntax for ActionScript statements. Is there a good book, or a good online source that most use?

        • 1. Re: Syntax Recommendation
          Level 7
          Type the keyword into the actionscript window, select it and hit F1. This
          will open Flash Actionscript dictionary, and take you to that word's entry

          --
          -------------------------------
          Remove '_spamkiller_' to mail
          -------------------------------


          • 2. Re: Syntax Recommendation
            kglad Adobe Community Professional & MVP
            i use the flash help files that i have grouped with my actions panel along the lower part of my flash.
            • 3. Re: Syntax Recommendation
              NetBossUSA
              Grouping those is a good idea, a simple click and you can look at the help files. Does anyone else use any other methods for quick fixes on syntax errors. They seem to be the one thing that stops me or slows me down when using actionscript. Looking up the proper syntax always takes me too long so I'm curious how others do it.

              Thanks kglad that was a good hint... I will group mine the same way... Anyone else?
              • 4. Re: Syntax Recommendation
                kglad Adobe Community Professional & MVP
                actually, the greatest time saver has been understanding where in the help file to look. i always use ActionScript 2.0 Language Reference.

                once you know what class'es method or property with which you want help, check under that class, then the method or property name.

                i rarely use the search feature because it brings up too many entries, most of which are no help to me.

                (if i used components i'd check components language reference/components dictionary.)

                • 5. Re: Syntax Recommendation
                  Rothrock Level 5
                  Yup no substitute for using the help file. And always use the Language Reference and/or the Component Dictionary if you use those. It is right there and (for the most part anyways) it is always right.

                  It is truly amazing how many people completely resist doing this simple thing. Before Flash 7 the help files where quite dismal and didn't include code samples and such. But now…they rock!
                  • 6. Re: Syntax Recommendation
                    NetBossUSA
                    Great suggestions thank you... I'll try them all and see which ones work best for me.

                    So how about when you need syntax help for something like this...

                    function questions() {
                    _root["question" + questionNumb[0]].play();
                    }

                    If you wanted this statement to run the same file every time it would be simple...

                    function question() {
                    _root.question3.play();
                    }

                    But I wanted the question number to be determined by an array that was shuffled every time the user needed it.
                    It took me for ever to find the proper syntax for this and finally someone right here in the forum gave me this code and I realized that all I was doing wrong was that I left out the second set of brackets [ ]

                    When you are concatenating different statements together as the above example it is always hard for me to get just the right syntax. Is there a good spot for those type of syntax errors?

                    • 7. Re: Syntax Recommendation
                      kglad Adobe Community Professional & MVP
                      i know of no place to look for help with that syntax. i don't even know what to call that.

                      i always refer to that as: to help flash resolve a string to an object use bracket notation, but i'm not sure that's correct.
                      • 8. Re: Syntax Recommendation
                        Rothrock Level 5
                        I call it array notation. If you look at the array class help files you will see at the bottom a link to:

                        [] array access operator

                        And there you will see the different ways you can use it.

                        As for getting the correct syntax it was hard for me in the beginning as well. But remember each part of it is its own thing. So if you can get each piece correct then string them together. So traces and checking the values of each part should help.
                        • 9. Re: Syntax Recommendation
                          kglad Adobe Community Professional & MVP
                          i've seen it called array notation, but that's misleading (to my thinking) because it has nothing to do with an array in the context of string resolution to an object.
                          • 10. Re: Syntax Recommendation
                            Rothrock Level 5
                            Yeah, but that is where the documentation about it is. So what are ya' gonna do? :)

                            And in a sense the list of objects inside each object is stored as an array so to my mind it makes sense. At least that notion (and don't dispel it if I'm wrong!) helped me to understand it.
                            • 11. Re: Syntax Recommendation
                              kglad Adobe Community Professional & MVP
                              hey, that makes sense to me too. i never thought about it that way, though.

                              thanks rock.