5 Replies Latest reply on Nov 1, 2007 5:19 PM by kglad

    Confused over the "WHY"

    itgranny
      I know this is going to sound like I'm a smart aleck but I'm just trying to figure it all out and so far things have not been answered in a way that I can understand. I must be missing something because I can't seem to figure out the reason for actionscript (.as) files. I don't come from a programming background and I've been trying to figure out this stuff on my own for quite some time. I believe the trouble lies in the question "Why would Adobe/Macromedia think doing it this way is a good thing?"

      What is the benefit of having .as files over having the script incorporated right in the movie file (other than for components)? I've gone through several Flash Training programs and no one's given a really good explaination. From my point of view, it seems to leave me wide open to make mistakes. The code is more complex, you got the public and private and different rules than in the movie files. You're left wide open to lose things, especially if your hard drive crashes. Also, if you want to share, you need to send a whole folder full of stuff to make it work.

      I'm must be missing some very important point(s) here because the complexity and confusion to me seems like something that companies would avoid. Does anyone know of a good resource that truely explains this stuff and doesn't just tell you to "do this", "do that".

      I've never been a good one to memorize stuff, but if i can actually understand it, it becomes mine.
        • 1. Re: Confused over the "WHY"
          kglad Adobe Community Professional & MVP
          it really isn't a good system for most non-professionals. if you want to create some modest flash content that's not going to change in the future, it's much easier to code within the authoring environment and not use class files.

          i code within the flash ide all the time especially when testing something i've never done before. then for appropriate projects i take what i've learned and use oop and class files.

          however, if you are creating a large complex project (and especially if you're collaborating with others), using classes and oop is very helpful. if you create lots of projects and find the need to use (and re-use) certain blocks of code, using class files can be very helpful.

          and even for small projects (like my website www.kglad.com) i used class files because i knew when i started i would want to add features in the future.

          in fact, this past weekend i added a new "about me" button. and that loads a bio.swf that contains 5 more buttons and each of those does something. that entire update was trivial because i had created a button class that creates the button graphics and button actions (rollover, rollout and press).

          all i had to do was supply the button's label, its x,y properties and its action (load something, navigate to somewhere or execute php file).

          but again, you're correct: for simple things, the extra work creating a class file isn't worth-while unless the project is large or uses multiple contributers or needs to be easily extensible.
          • 2. Re: Confused over the "WHY"
            Rothrock Level 5
            Glad to know that I am not the only one who sometimes does it first in the IDE and then moves it over to a class.

            And I agree with everything kglad said. The real value of this type of approach comes when you will be working with others.

            In many ways I look at classes as being "black boxes." You put this in hear and that comes out there. The actual mechanism isn't that important. (Assuming the coding is sound in general.) So different parts of the team can work on different parts of the problem.

            As for a good resource, I recommend Colin Moock's books on Actionscript. He is very good about explaining why something is done.
            • 3. Re: Confused over the "WHY"
              knew-bee Level 1
              Speaking as a C++ programmer, I have been avoiding actionscript until now. I've always found the coding structure to be a mess. Previous versions of flash had you throwing snippets of code all over the place... the timeline, movieclips, buttons... it's just so disorganized.
              With AS3 everything is finally coming together. It all makes sense now and I'm actually enjoying programming in flash.

              So to answer your question, I think Adobe created AS3 to be more appealing to programmers from a more traditional background.
              • 4. Re: Confused over the "WHY"
                itgranny Level 1
                Thanks for the help. I guess the confusion comes because I always assume they show you the "best" way or only way of accomplishing a job. It's good to know that it's examples and not necessarily best practices. I think that was the confusing part of it all.

                I guess I've been trying since MX, skipped over 2004, got 8 and now CS3. While it seems i put a lot of time into studying it, i don't have the occasion to actually put it into practice much and therefore i've never gotten much chance to really practice it.

                Thanks everyone!
                • 5. Re: Confused over the "WHY"
                  kglad Adobe Community Professional & MVP
                  you're welcome.