PDA

Click to See Complete Forum and Search --> : path naming conventions



kobo531
01-16-2004, 10:20 AM
hi,

i'm working on a student flash standalone application with a friend. we split our work such that we create separate games which will be put together in a single flash movie.

usually i just call my variables by _root.something, but now should i call it by _root.myGame.something or there is a better way to go about it? I am afraid we might have trouble integrating our games into a single movie after we finished them.

thanks. :smoov:

aversion
01-16-2004, 12:54 PM
how will you integrate the two games? They will be separate SWFs loaded into a single holding SWF?

kobo531
01-17-2004, 02:00 PM
yes, that's right. in fact there will b more than 2 games. because they r goin 2 share some variables, like perhaps username.

SJT
01-17-2004, 03:40 PM
Using _root is liable to mess everything up once a movie is loaded into another.

If you want to put you variables in a place you can access easily from anywhere, you should use _global.
As for having conflicting variable names, the only real solution to this is to use a naming convention so that you and your friend don't ever accidentally overwrite each others stuff.
Probably the best way to do this is to make a global container for each movie's variables.
So you'd do something like:
_global.footballGame.var1
or
_global.sam.var1

The best thing to do is to agree on a strategy for naming and then both of you stick to it; it'll save a lot of headaches in the end.