9 Replies Latest reply on Aug 18, 2008 2:12 PM by (Smob)

    Learning Java Script ?

      Hi
      In this link I was ask about Java script and expressions
      http://www.adobeforums.com/webx/.59b58654/3
      Now I've another question, and I hope you give me the answer
      Ok
      Let's say I'm going to learn Java Script
      What about HTML???
      As I read in some references, Java script is a language for helping HTML language
      It's make the web page more dynamic
      My question is:
      Should I learn HTML before I learn Java Script?
      If the answer is: NO (I hope it's: NO, because I hate the programming languages)
      I've another question or another problem:
      All of Java script books talking about website design or explaining Java script according to website designing, and all of the examples and exercises are about website designing
      How can use it in After Effects?
      I'm sorry about my questions, but forgive me; I have no idea about the programming in general
      May be I learn the basics of Java script with these references and then I use it with After Effects!!!
      Again, how?
      How can I use the language which created for website designing with software like After Effects???
      Sorry again
      And I hope you guide me
      Thanks,
        • 1. Re: Learning Java Script ?
          Mylenium Most Valuable Participant
          No problem, that's why we are here for. To answer your questions:

          Learning HTML is not necessary, but it helps to understand a structured approach to programming. The language itself is no programming language, but a document description language that tells a browser how to display elemts within that page. JavaScript elements within that page are used to add dynamic content, but are by themselves merely an optional sub-set. In strict terms there is not even a way to legally enforce that a browser be able to handle this, it just has become widely adopted due to the obvious benefits.

          It is also a nice way of trying out some basic techniques outside After Effects or Flash in a fully dynamic runtime environemnt. most books are web- or Flash-centric, simply because obviously this is a much, much bigger market than scripting or expressions in AE. Imagine perhaps 5 million After Effects users out of which only 500000 use expressions/ scripting and now compare that to 500 million agencies, web hosting companies, private people and so on who maintain a website or make a business out of making them for other people.

          JavaScript/ ECMA script is very generic and was never specifically tailored to web design only. It is what is called an interpreted/ interpreter language and is one of many such languages. Other examples are Python, Perl, Ruby, PHP. The only difference is, that Java/ JavaScript was developed commercially by Sun and thus evolved very quickly and on a broad basis. If you will, Sun had the bucks to push it into the market. It also came at the right time, so in part this is just lucky coincidence.

          If you wanna learn JavaScript, focus on the essentials. Filter out the web-specific "noise". So for instance whenever you hear about something like parent.window, navigator.appVersion or similar specific stuff, then that should not interest you. These are dedicated browser DOM (document object model) types, functions and classes that don't exist in AE or most other apps. However, they can provide you with some insights into JavaScript's inheritance model. E.g.

          parent.window

          would refer to the main browser window, and

          parent.window.active

          would tell you if it is the current active browser window. Similar realtionships exist between other items. This will become clear to you if you ever do JSX scripts, where these dependencies are used to express e.g. how a footage item belongs to the project structure or which button belongs on which panel.

          The other things that are important to you is anything that begins with if(), while(), for(), case() and so on. These key phrases are functions that contain the actual logic inside them and it may be interesting to disect and learn them. Inside such functions you will also find the other essential methods for comparing variables (==, !=), incrementing and decrementing counters (+=,++ and so on) plus ways of making decisions based on whether some of the counters reach a specific value or a condition is met:

          if( x==1)
          {do this}
          else
          {do that}

          Furthermore you will see how to return variables or interrupt the function flow if it does not yield results (return, break, continue).

          A special part of any programming is mathematics. Simple operators like +, -, * and / can be defined straight away, for more complex stuff you will often use a function from the Math. class. For instance

          Math.sin()

          refers to the Sinus function predefined within this class. Another item to watch out is anything that starts or ends with .string / string. . these are functions that deal with text and are for obvious reasons a huge part of web-based JavaScript. Thanks to the text layers introduced in AE 6, they have their value there as well to create counters or animate text in funny ways.

          A last thing to take a look at are the interaction methods like onUp(), onClick() and so on. They have no relevance for expressions, but may come into play for scripts.

          I also recommend you take a look at Flash and Dreamweaver. There are some good sections on this stuff in the help files and Flash's ActionScript is similar enough to JavaScript to provide some insights. It also has the advantage that you can find a million example projects that you can study and you can get lots of help on web developer forums. For the AE specific stuff, simply come here. We will gladly help you.

          Mylenium
          • 2. Re: Learning Java Script ?
            Level 1
            I read your answer in hurriedness
            and I need to read it again
            but now
            from your answer ,I understand the following below :
            1- I must learn or focus on some points of java script which help me in Ae
            2- I don't need to learn HTML
            3- you are very kind man
            thank you very much
            • 3. Re: Learning Java Script ?
              David Wigforss-Hv1BNN Level 2
              I'm impressed with Mylenium's post as well. Kudos.

              I think there might be some video tutorials that focus on Javascript with AE (maybe just cover expressions rather than scripting though) that might help you out alot. It'll definately benefit you by hearing someone explain this programming stuff rather than just reading thru a javascript book. There's too many foreign concepts to understand...

              Keep in mind, just because you know javascript doesn't mean you'll immediately be able to create AE scripts and expressions.. There's many things that are Adobe and After Effects specific (take a look at the Scripting Guide for descriptions of Object Model stuff). Continuing with that thought, just because I know some javascript and AE, doesn't necessarily mean I can create awesome Softimage XSI scripts (which also uses javascript as scripting language, along with Python, vbscript). You need to learn Object Model.

              These sites will help you a lot. Read thru them many many times.
              www.jjgifford.com/expressions/index.html
              www.motionscript.com
              www.aeenhancers.com
              • 4. Re: Learning Java Script ?
                Level 1
                Nice post Mylenium! However, didn't Netscape create JavaScript, not Sun? And, doesn't JavaScript have no relation to Java whatsoever? ;)
                • 5. Re: Learning Java Script ?
                  Level 1
                  <plumeragent@adobeforums.com> wrote in message <br />news:59b5a279.3@webcrossing.la2eafNXanI...<br />> Nice post Mylenium! However, didn't Netscape create JavaScript, not Sun? <br />> And, doesn't JavaScript have no relation to Java whatsoever? ;)<br /><br />It's a tangled web, so to speak. ;) When Netscape added Java support to <br />Navigator, a scripting language called LiveScript was developed by Netscape <br />for the purpose of making Navigator's Java support more accessible to <br />non-Java programmers.  The name LiveScript was changed to JavaScript during <br />the beta cycle and both Sun and Netscape jointly announced JavaScript.   Sun <br />owns the JavaScript trademark.
                  • 6. Re: Learning Java Script ?
                    Mylenium Most Valuable Participant
                    As mentioned by Robert, the language itself already existed (was defined in rough form some time around 1991). What we owe to Netscape is for the most part DOM and a few browser specific implementation features...

                    Mylenium
                    • 7. Re: Learning Java Script ?
                      Where do I find out about Javascript objects, like Panel, that are not specific to AE? I see there are a number of books available, but I am just looking for the definitions of the attributes, methods, and events.
                      • 8. Re: Learning Java Script ?
                        A. Cobb Level 3
                        For ExtendScript stuff that isn't AE-specific, look in the JavaScript Tools guide (there's a shortcut in ExtendScript Toolkit 2 under Help->SDK). All the UI stuff is documented in there, including Panel.
                        • 9. Re: Learning Java Script ?
                          I found it with your help. Thanx!