Skip navigation
Currently Being Moderated

Using Classes?

Sep 2, 2012 4:18 PM

Tags: #as3.0 #actionscript3 #classes?

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 . . .

 
Replies
  • Currently Being Moderated
    Sep 2, 2012 6:23 PM   in reply to Claunchster

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points