A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: path naming conventions

  1. #1
    Junior Member
    Join Date
    Aug 2003
    Posts
    11

    path naming conventions

    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.

  2. #2
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917
    how will you integrate the two games? They will be separate SWFs loaded into a single holding SWF?

  3. #3
    Junior Member
    Join Date
    Aug 2003
    Posts
    11
    yes, that's right. in fact there will b more than 2 games. because they r goin 2 share some variables, like perhaps username.

  4. #4
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    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:
    code:
    _global.footballGame.var1


    or
    code:
    _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.
    Sam



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center