Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-07-2007, 02:15 PM   #1
PaulSheffield
Registered User
 
Join Date: Aug 2007
Posts: 17
Question AS2 naming conventions: suffix or prefix?

I'm just setting out learning actionScript. Wanting to do it by the book like a good boy, I recently attended a Macromedia authorised training course where the materials used prefixes to name new objects/instances:
mcMovie
btnButton
txtTextField
and so on.

However, the Flash8 help files suggest using _suffixes:
movie_mc
button_btn
etc...

Does it make any difference (I know that code-hinting in Flash8 is triggered by the suffixes)? Is one method more widely used, or more appropriate for AS3?

TIA
PaulSheffield is offline   Reply With Quote
Old 09-07-2007, 02:23 PM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,879
Default

Howdy and Welcome...

I use the suffix only because of the code hinting and funny thing is that I don't use that code hinting at all... I just keep type the function instead of selecting it from that...

I think people from other language background mostly go by the prefix because that's abit more widely used method, but I don't think it really matters as long as you are consistent in your code... Just use something that you are most comfortable with and you should be good...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 09-07-2007, 02:32 PM   #3
PaulSheffield
Registered User
 
Join Date: Aug 2007
Posts: 17
Default

Thanks

In that case, I think I'll go with the first method, simply because I learned not to use the _underscore_ writing html and it feels kinda weird using it in AS2!
PaulSheffield is offline   Reply With Quote
Old 09-07-2007, 02:45 PM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,879
Default

Whatever you are most comfortable with...

Can you clarify your reason abit though cuz I don't really understand that...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 09-07-2007, 06:32 PM   #5
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
Default

if you want to force the code hints this will work for some of the items. not sure if it works for all of them:

in your code do:
ActionScript Code:
// got to do this next line to get your code hint // MovieClip mcMyMovie;
then when you type in mcMyMovie. - at the '.' you will get the code hints pop up for the movie clip.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 09-07-2007, 09:45 PM   #6
PaulSheffield
Registered User
 
Join Date: Aug 2007
Posts: 17
Default

Quote:
Originally Posted by CyanBlue View Post
Whatever you are most comfortable with...

Can you clarify your reason abit though cuz I don't really understand that...
I've seen underscores discouraged in folder/file names in html from a usability standpoint: a live link is indicated by default in your browser with an underscore, so a link with its own underscore becomes hard to read by eye and looks like it has a gap in it: underscore_underscore.com becomes:

http://www.underscore_underscore.com

It's a small point, but it got me out of using underscores at all in web design.

Hope that made sense
PaulSheffield is offline   Reply With Quote
Old 09-07-2007, 09:47 PM   #7
PaulSheffield
Registered User
 
Join Date: Aug 2007
Posts: 17
Default

Thanks tg, that's gonna be useful! I need all the hints I can get.
PaulSheffield is offline   Reply With Quote
Old 09-07-2007, 09:57 PM   #8
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,879
Default

Well... That is a valid point, but I don't know how that could be really related to the programming in general... We are talking about something that's only visible to the developers not the end users...

Never tried that nor will I try that, but that's good to know, tg... I always have trouble with the that notation... My brain simply does not work with that somehow...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 09-08-2007, 09:07 PM   #9
PaulSheffield
Registered User
 
Join Date: Aug 2007
Posts: 17
Default

Quote:
Originally Posted by CyanBlue View Post
Well... That is a valid point, but I don't know how that could be really related to the programming in general... We are talking about something that's only visible to the developers not the end users...
(
Agreed. Just explaining why I have a downer on underscores. It's just a key combination that doesn't feel right to me.
PaulSheffield is offline   Reply With Quote
Old 09-08-2007, 09:46 PM   #10
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
Default

just my practice:

Anything built in the GUI gets the appropriate suffix. IE moveclip on the stage gets named myClip_mc.

Anything built with code does NOT get a suffix, but data typed.

This lets me very quickly see if I'm referencing a dynamic object or static.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman
Flash Gordon 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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
internal actionscript naming conventions phloam ActionScript 2.0 7 10-24-2008 01:48 PM
AS3 loads AS2 swf. AS2 swf not displayed darbar ActionScript 3.0 0 07-20-2007 10:12 PM
about the naming conventions mentioned in the xml tutorial bassouma86 Other Flash General Questions 2 11-27-2003 01:37 PM


All times are GMT. The time now is 05:50 PM.


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