PDA

View Full Version : Proper Design Technique


etrance
09-06-2004, 05:17 PM
Hello Everyone!

just a quick note for discussion. I was wonering what everyones approach was to design. I have a programming background and in general it is a bad thing to use global variables.

Do you all go out of your way to avoid using _global and _root? What are some of the strategies you use to move data between movie clips and objects?

Is it common to put all your functions in external scribt libraries?

more of a discussion topic. I have no immidiate problems with this. Just trying to learn and have stronger starting points to my projects.

Thanks in advance.

I think that this could be usefull to many of us.

Cheers!
E

deQue
09-06-2004, 05:34 PM
My practices are to put all possible code outside of the design, and split it into similar subject groups. This makes it easier in the future, should someone else will have to go through your code, and change/add stuff to it. It makes modifying a specific function to the client's demands with extra ease, and saves time of going through gazillion lines of code.
Plus, it keeps the "programmers" out of your graphics and components, which is always a good thing to do. :D

As for moving data from one object to the other, Each case to its own. I usually use Flags and static vars with _global, cause it's usually stuff like Server IDs, Request Types, and stuff that I might want to have access to from different places.
Other than that, I try to keep my vars private. Get it? private? I crack myself up sometimes... :D

etrance
09-06-2004, 06:07 PM
So similar to classic Object Oriented Desing.

Thanks for the input... I thought more people might have had a an opinion on this. I guess more people are preoccupied with loaders... hehe I'm always digging in that as well. :D

Thanks Again.

Overandout!
E

deQue
09-06-2004, 07:06 PM
Give it time. People here are from all over the world, and usually takes time till they read the forums.

Kron_Job
09-06-2004, 07:36 PM
when I code, I usually place any large blocks of code into an empty movie clip, and invoke when required... this allows for my code to use movie clip features, like a frames based loop for timed events.

for common .swf files, I use an imported class.as file that is included when published.

I also like using alot of little .xml files.

and when writing class' I can get strict about declaring variables, but I worry more about deleting unused variables than I do about not having globals. However, since my code is usually inside a movie clip, that keeps the variables inside the movie clip, and they are no longer _root or _global. gone with the MC.

my 2 cents.