• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using Classes?

Community Beginner ,
Sep 02, 2012 Sep 02, 2012

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

503

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 02, 2012 Sep 02, 2012

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

...

Votes

Translate

Translate
Community Beginner ,
Sep 02, 2012 Sep 02, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 02, 2012 Sep 02, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 02, 2012 Sep 02, 2012

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines