4 Replies Latest reply on Jul 29, 2006 8:02 PM by butcho

    THEORY

    yarkehsiow Level 1
      hello,
      i have a "master" movie which loads another .swf on frame 5. after that each of the movies has a keyframe every 5 frames on the actions layer.
      i have some script in each movie on each of the keyframes. it has become fairly confusing to try to match them up and remember what is where.

      my question: in terms of proper AS form, is this correct? or should all code be in the "master"? also, is it good practice to have AS on multiple frames in a movie, or should it all be on one frame with functions called at certain times?

      any ideas, or links to articles on this subject appreciated.
      thanks.
        • 1. Re: THEORY
          kglad Adobe Community Professional & MVP
          you should try and keep as much code as practicable attached to one frame of one timeline. but there are many occasions when it's not wise to attach all the coding to one frame of one timeline.

          a major problem for inexperienced users is that attaching code to one frame of one timeline requires an understanding of paths to reference objects on other timelines and that understanding is not something that is easy for everyone.

          coding for an external swf is usually best kept in the external swf. part of the reason for using an external swf is to break a larger project into a collection of smaller projects to make it easier to create.

          coding within any one swf is best kept to one frame of one timeline but as mentioned above, that's not always true and almost always requires familiarity with paths.
          • 2. Re: THEORY
            yarkehsiow Level 1
            excellent, thank you, kglad.
            i will try to re-organize on a copy and see what happens.

            one follow up- is it "proper" to use muliple layers for AS?
            in other words, if i have some code that should be accesible over the entire length of the timeline, but for some reason i need to
            put one piece of code in a particular keyframe along the way, should i make one actions layer that spans the whole movie, and another with keyframes for specific pieces of code? (it seems to me that this could further organize "types" of code...)
            thanks!

            • 3. Re: THEORY
              kglad Adobe Community Professional & MVP
              using one layer for actionscript is a good idea. if you have hundreds of lines of code you may even want to use more than one layer for your actionscript.

              i think, in general, it's a good idea to use many layers. you'll find your projects are much easier to control if you place each object (in the authoring environment) in its own layer. layers can be collapsed into folders for even better organization if you find yourself creating many layers.

              doing this is especially helpful if more than one person will need to work on a project or you return to a project after a number of months.
              • 4. THEORY
                Hi,

                i agree with Kglad. But if you plan to do a lot of actionscript in the futur keep in mind that the next step is the use of Classes. There is no better way to organize codes. And the OOP aspect of Classes will give you much more than that.

                There's a lot of programers out there that suggest to use classes only on big project with lot of actionScript. I dont agree; even on really small project i always use classes but hey, everyone has their own style .. thats the beauty of programation.