3 Replies Latest reply on Jul 22, 2006 5:38 AM by kalibahlutwo

    Using _global variables

      I have a variable on my Main Slide:

      _global.n = 0;

      on the second slide in a movie clip on the seond frame I have:


      When it traces it, it stays at 0. What am I doing wrong? Should I be sending something to the main slide to tell it to change n to 0? Everything I have read says this should work, but it doesn't! Any help would be greatly appreciated.
        • 1. Re: Using _global variables
          Rothrock Level 5
          Any time you want to assign the variable you need the _global and any time you just want to reference it you don't need it – but it doesn't hurt.

          So on frame 2 it should be:


          Of course you mention slides, so I don't know, that could mess everything up. ugh
          • 2. Re: Using _global variables
            shasmith Level 1
            I tried it. It worked except it worked too soon. When I tested the movie, it updated my variable automatically instead of waiting until the frame appeared. It's almost like it redeclared the variable. Any other suggestions?
            • 3. Re: Using _global variables
              kalibahlutwo Level 1
              That's the correct way to do it. Do you have a stop on your first frame (and then a way to advance to the next, of course, like a button or timer)? I've never worked with slides in flash, though, but I don't see why all the rules basic rules would change.