Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-31-2003, 01:00 AM   #1
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default Action Scripting, best practices

Okay... so I've been programming AS for roughly a year now... I've learned alot from Actionscript for Flash MX (the book) and I've learned alot from this forum.

I'm looking to take my skills to the next level by learning best practices. For instance, there are several different ways to write an onClipEvent,

1.) You can place your code "on top" of the movie clip
2.) You can place your code in a frame and do a:

ActionScript Code:
foo.onEnterFrame = function() {}

3.) you could place the code from #2 in a file and include it
4.) etc... etc..

As I was learning, in many of the web sites I created, the code was spread out all over the place... very unorganized.

When I write perl, PHP or C code, I have certain practices that I follow. For instance, whenever I write a perl CGI script, I create a dispatch table, which I keep inside a MAIN:{} block, etc, etc... I'm looking for examples of these kinds of practices in AS...

Can anyone point me to a tutorial or book where I can read up on best practices? Any suggestions would be appreciated.

-Theron

Last edited by thpii; 03-31-2003 at 01:03 AM.
thpii is offline   Reply With Quote
Old 03-31-2003, 01:13 AM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

It depends

It depends who you are - everyone has their own coding style
It depends what you are doing - different tasks are handled differently
It depends on how much time you have - some styles being better for revisiting and re-aculturation of code, though are often more time consuming and unpractical given certain time constraints.

... it depends.
__________________
(6)
senocular is offline   Reply With Quote
Old 03-31-2003, 01:20 AM   #3
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default

While I understand that different tasks call for different practices, I'm basically looking for best practices, i.e. most common ways of writing code for a web site.

Do I place code on different movieclips and in different frames all over the movie, or is it GENERALLY better to place all your code in an external file, etc...

I'm looking for a general consensus on the issue by people who have much more experience than I do, and I will certainly keep in mind that different tasks call for different practices. I've been coding for years, but not very long with AS, and Flash/AS is very different than other languages that I am used to... (i.e. Java, C, Perl)

-Theron
thpii is offline   Reply With Quote
Old 03-31-2003, 01:28 AM   #4
tyard
Registered User
 
Join Date: Jan 2003
Location: NYC
Posts: 58
Default

It's rarely good practice to place your code in different frames and movieclips. Place everything in your first frame (I split mine into layers on the first frame), or if you like coding in another editor, code there and use #include in Flash. If you're planning to reuse your code in different movies, obviously the #include way is more efficient. The same goes for graphic elements-- if you are reusing items, try to make them into components. It'll pay off in the end.
tyard is offline   Reply With Quote
Old 03-31-2003, 04:07 AM   #5
jubei
Chunky Samurai
 
jubei's Avatar
 
Join Date: Jun 2002
Location: Adelaide, Australia
Posts: 469
Send a message via ICQ to jubei Send a message via AIM to jubei Send a message via MSN to jubei Send a message via Yahoo to jubei
Default

There's an actionscript best practice whitepaper on macromedia.com. I'd recommend grabbing your info from that.
jubei is offline   Reply With Quote
Old 03-31-2003, 04:26 AM   #6
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default

Thanks for the feedback from everyone, and I'll go look for that white paper...

-Theron
thpii is offline   Reply With Quote
Old 03-31-2003, 04:27 AM   #7
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default

Thanks for the feedback from everyone, and I'll go look for that white paper...

-Theron
thpii is offline   Reply With Quote
Old 03-31-2003, 04:51 AM   #8
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default

Just in case anyone else who reads this thread wants it, that best practices white paper is here:

http://download.macromedia.com/pub/d..._standards.pdf

-Theron
thpii is offline   Reply With Quote
Old 03-31-2003, 04:51 AM   #9
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default

Just in case anyone else who reads this thread wants it, that best practices white paper is here:

http://download.macromedia.com/pub/d..._standards.pdf

-Theron
thpii is offline   Reply With Quote
Old 03-31-2003, 04:51 AM   #10
thpii
Where can I pet a monkey?
 
thpii's Avatar
 
Join Date: Sep 2002
Location: CT
Posts: 245
Send a message via ICQ to thpii Send a message via AIM to thpii Send a message via Yahoo to thpii
Default

Just in case anyone else who reads this thread wants it, that best practices white paper is here:

http://download.macromedia.com/pub/d..._standards.pdf

-Theron
thpii is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:35 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.