3 Replies Latest reply on Sep 2, 2012 6:28 PM by Claunchster

    Using Classes?

    Claunchster Level 1

      I have been using flash for a while now, but have been reluctant to delve into classes so far.  I'm used to writing all my code on the main timeline (I know, big no no!). So I have what will probably be a very simple question.  I have a class that I use and works great, and it affects 3 movie clips that I have that get added dynamically through the class.  So far so good.  How can I use the class to have the same effect on three duplicate movie clips on another frame or scene?  I hope this makes sense? Do I import the class on each frame or scene I need them to be work on even though it is set as my document class?  Would it help to see the code? Maybe? I don't know . . .

        • 1. Re: Using Classes?
          Claunchster Level 1

          Or . . . how could I convert the class to work on the main timeline?

          • 2. Re: Using Classes?
            Ned Murphy Adobe Community Professional & MVP

            There are those who defend coding outside of the timeline and there are those who don't... I don't.  You should feel good about being able to code at all, and you can work on learning to code outside of the document as you go as well.


            Another approach for having a document class or code in the timeline is to keep everything in one frame and manage it all there.  This can involve dynamically adding/removing content as needed, controlling visibility, and switching child indices.


            As far as converting the code to work on the main timeline, if you are familiar with timeline coding, then you might be able to see it more clearly if you remove all of the class file dressing (the "package", "public", "private", and structural braces).  A number of import statements become unecessary when working in the timeline, but having them does no harm.

            • 3. Re: Using Classes?
              Claunchster Level 1

              Thanks for the encouragement Ned. I do like coding on the main timeline because it is so much easier for me to understand what I have going on. I was however able to get my classes to load using some import statements and creating a new var and then using addChild to load it. Thanks again.


              Clayton Claunch


              "Do, or do not. There is no try." - Yoda


              Sent from my iPhone