5 Replies Latest reply on Sep 9, 2009 12:07 PM by Rothrock

    Best way to learn actionscript?

    oluc Level 1

      I have been using Flash for several years now but I need to get serious about learning actionscript. I have done quite a few things with actionscript but I don't really understand it...

      I'm going to be starting a massive interactive AV project and I need to learn the right way to program this.

      I'm looking for a way to really learn it starting with the basics. Do you know of a very good book that explains what each of the different things mean with examples or such so I can get a real understanding of it? How did you learn it? I've bought several books but they are over my head:
      Understanding Macromedia Flash 8 Actionscript 2 by Andrew Rapo and Alex Michael
      Essential Actionscript 2.0 by Colin Moock
      Foundation Actionscript 3.0 Animation - Making Things Move! by Keith Peters

      Is the best way to just read it from a book or is there a better way? The problem I have in reading it from a books is that I have a lack of examples and so get lost and don't know how it all goes together.

      Hopefully this post communicates! If you don't understand me or need more data from me pls let me know.
      Oh yeah, and I currently have Macromedia Flash 8 but plan on upgrading soon to the latest one.

      Thanks for any direction!

        • 1. Re: Best way to learn actionscript?
          Jimmathy

          I am far from a professional, but if you are trying to learn quick I find Actionscript 2 more friendly. Actionscript 3.0 just blows my mind and I am lost. So I'll just tell you that, I personally learned to script thru asking questions on this forum, and looking up specific tutorials, it has worked well for me, but this may not be the answer for you. There are a boat load of good tutorials out there, you just gotta look for them

          • 2. Re: Best way to learn actionscript?
            oluc Level 1

            Thankyou for your helpful reply. I am looking to learn 2.0. I have done quite a bit with it already from reading tutorials and figuring out script etc. but the problem is that I don't really understand what it all means and I would not be able to just write out the actionscript without refering to the tutorials or other script. I know that I need to learn MVC and OOP. The project that I am going to be doing will be a set of over 10 different interactive AV presentations that someone could choose from. And in these they will display pictures or videos or be otherwise interactive. These will be on a bunch of computers over a network...

            But thank you.

            • 3. Re: Best way to learn actionscript?
              Rothrock Level 5

              Unless you have a specific need for AS2 I would counsel against starting there. AS3 is the way of the future for flash and one of the main reasons that so many find it confusing is because they have started with AS2 and it has warped them into its way of doing things. If you don't know any better AS3 isn't any more confusing than AS2.

               

              And the benefits of AS3 are so much better that it really makes a lot of things better.

               

              As for examples...well the Keith Peters book is genius and he is very good about explaining each step and building from one step to the next. But of course if you REALLY want to learn AS2 then the AS3 version of that book is really not going to help you. I have worked with that book quite a bit and if you aren't finding enough examples in it then I have to wonder if you are really looking at the same book. Almost every page is an example.

               

              Another good thing to know is how to use the Flash help system. I've been doing heavy Flash coding for many years now and I still can't remember everything in the exact order needed and such – and spelling and capitalization count!

               

              If Flash almost everything is organized into classes. A class revolves around one type of thing, so for example TextField or Array. Within each class there are properties, methods, and events – some classes have all of these (and many of each) and some only have a few. Each time you use a class you create an instance of that class. So if you put a few movieclips on the stage each of those clips is an instance of the MovieClip classs.

               

              Properties are just what they sound like, they are attributes that each instance has. So some movieclip on your stage will have a _x and _y position, an _alpha value, a _rotation, and so on. In AS2 they usually start with an underscore (but not always) and in AS3 they don't have the underscore. Properties are just like variables that you might create. Those are all properties and they are usually a noun.

               

              Methods are ways of doing things to an instance. So for example you might know someMovieClip.gotoAndPlay(5). That is a method of the MovieClip class and it tells a movieclip to go to a specific frame and play. Methods usually have parenthesis after them. Sometimes you put arguments inside of those, sometimes not, but seeing those you should say to yourself, "Ah that looks like a method." They are very similar to functions. Methods usually have a verb somewhere in their name to indicate that they are actions.

               

              Finally there are the events. And again they are just what they sound like – an event is when something happens. So for example with a MovieClip and event might be when the mouse rolls over the clip or perhaps when it is clicked. Here is one of the big benefits of AS3 over AS2. In AS2 there are many ways to handle events. Some of them just are like movieclips where you do code like this:

               

              myClip.onPress=someFunction

               

              But you might also register a listener:

               

              myInstance.addListener(someObject);

               

              Or even:

               

              myInstance.addEventListener(someObject,someFunction);

               

              That gets confusing. But with AS3 there is only one way (the last listed there.) So if you've put in the effort to learn the crazy three ways then the simplicity of AS3 is actually different and a hassle. But if you don't know any better then it just seems right.

               

              But I digress....

               

              So back to how to use the help files. So if you want to do something with say a text you open up the help and navigate to the ActionScript 3.0 Language and Components section. You scroll through the list of classes -- yes there are quite a few, but not that many and if you take a few minutes to read them you will start to figure out what they are for. So for text you will find quite a few that begin with the word text, but TextField would seem to be the most promising. So start there.

               

              This will bring up a list of all the properties, methods, and events that are part of each instance of a TextField. These are all the things you can do — there are no others.

               

              A little trick is that some classes get some of the things they can do from their parent classes. In other words they inherit properties, methods, and/or events from some parent classes that they extend. In the help list there is a link that allows you to show or hide these inheritances. So for example a TextField has an alpha property, not because of itself, but because it descends for DisplayObject...well...don't get too hung up on that right now, but just notice that you might need to click that link to show all the properties, methods, and events.

               

              So each time you have a new thing to do — video, movieclip, sound, bitmaps, etc. — go find the class or classes that relate to that and read over those entries. Remember they are made by people to have meaning and be useful. So even if you don't know much about the Video class you can guess pretty quickly what videoWidth or attachCamera() might do.

               

              Yes the help can be totally overwhelming, but it really is helpful if you just spend some time learning how to use it.

               

              The other good thing to do is come here and ask questions. People here are all volunteers and are very generous with help and advice. But the best way to get help is to help yourself. So if you can't figure out what class you need come here and ask, but then actually do read the entries. Then if those don't make sense come back and say, "Okay, I'm readying the entry for SharedObject and I just can't get a handle on what setDirty() does and why it is needed. Can anybody help with that." (By now you totally recognized that as a method, right? Because it had a verb and parenthesis.)

               

               

              • 4. Re: Best way to learn actionscript?
                oluc Level 1

                Thankyou Rothrock - sorry it took me so long to answer - I have been having trouble logging onto Adobe from my computer.

                I appreciate you lengthy answer!!!

                 

                I'm definitly going with AS3. I started reading Essential ActionScript 3 and once I got through a couple of chapters I started on the book by Keith Peters and you are right - he is genius and its a great book.

                • 5. Re: Best way to learn actionscript?
                  Rothrock Level 5

                  Glad to know I helped you out. Have fun.