Best place to put code?

No problem with code, just where to put it

Page 1 of 1

4 Replies - 816 Views - Last Post: 11 September 2008 - 01:14 PM

#1 icedd  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 98
  • Joined: 04-March 08

Best place to put code?

Post icon  Posted 11 September 2008 - 12:31 PM

Hey all, I'm still new to action script. Self taught. So please excuse my lack of knowledge in programming terms.

My problem: I have been doing simple drills to help my self keep on a steady learning curve. As my drills get increasingly more complicated, I'm having trouble keeping my code / code placement clean. I seem to have code everywhere. For example ( I'll have code on buttons, frames, MC's, different frames. Which makes it hard to find and keep track of.

MY QUESTION: Is it possible to write the majourity or even all of your code on just the frame(s) alone? And would it be better for me to learn how to write my code in the time line rather then one the buttons and MC.

Is This A Good Question/Topic? 0
  • +

Replies To: Best place to put code?

#2 Martyr2  Icon User is online

  • Programming Theoretician
  • member icon

Reputation: 4438
  • View blog
  • Posts: 12,308
  • Joined: 18-April 07

Re: Best place to put code?

Posted 11 September 2008 - 12:56 PM

Ideally you want to create your own layer called "Actions" and then you can place all your code there. By creating this actions layer on the timeline you can quickly and easily put all your code there to have it manipulate the other layers and frames. This is one of the good habits you should adopt for organizing your code.

Hope that helps you out. :)
Was This Post Helpful? 0
  • +
  • -

#3 icedd  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 98
  • Joined: 04-March 08

Re: Best place to put code?

Posted 11 September 2008 - 01:00 PM

Hey that does help me out thank you. :)

Though I would still like to know if say I made a matching game program for example. Could I put all the code on one frame in the actions layer. Or should It be spread out. What is the best practice?
Was This Post Helpful? 0
  • +
  • -

#4 Martyr2  Icon User is online

  • Programming Theoretician
  • member icon

Reputation: 4438
  • View blog
  • Posts: 12,308
  • Joined: 18-April 07

Re: Best place to put code?

Posted 11 September 2008 - 01:07 PM

It is certainly advisable that you keep all your code in one single location such as frame 1 of the actions layer (frame script). Another place you can put code is in actionscript code files. Keeping all your code in one easy to find location will make your life great.

:)
Was This Post Helpful? 0
  • +
  • -

#5 icedd  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 98
  • Joined: 04-March 08

Re: Best place to put code?

Posted 11 September 2008 - 01:14 PM

Thank you very much :)

Also please look at my new topic as I'm not exactly sure how to write something
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1