6 Replies Latest reply on Aug 2, 2006 2:17 PM by Rothrock

    How can I found out which swf is loaded?

    Josh_Pratt Level 1
      I need to write an if statement for my menu to find out which swf is loaded into a certain level.

      On my menu, I have code that when a user clicks on a button, it reloads a new swf over itself into the same level. I have the menu in a shared library, but the code is in the menu itself. Probably not the best design, but I have to work with it now.

      I need some code to figure out which swf is loaded into level 5. How can I do that? I need to be able to determine the swf and store it as a virable such as "calendar.swf"
        • 1. Re: How can I found out which swf is loaded?
          AbsentBodied
          I believe you could check _leve5._name.

          Make sure it's loaded first with _level5.getBytesLoaded() / _level5.getBytesTotal()
          • 2. Re: How can I found out which swf is loaded?
            kglad Adobe Community Professional & MVP
            you need to add code to your button to store the value of the swf that's about to load.
            • 3. Re: How can I found out which swf is loaded?
              Josh_Pratt Level 1
              Ok, I set a global variable to pass which page is loaded. I'd like to recall it now, but I'm not quite sure how to do it.

              The variable is this: _global.newpage

              I need to take that variable and use it as an instance name for a button to disable it.. I just can't figure out how to use that variable in the enable line because this doesn't work:

              _global.newpage.enable = false;

              That would be like trying to disable the global variable... What is the correct syntax to use that variable correctly in that line of code?
              • 4. Re: How can I found out which swf is loaded?
                Rothrock Level 5
                _level5[newpage+"_btn"].enable=false;
                • 5. Re: How can I found out which swf is loaded?
                  Josh_Pratt Level 1
                  That didn't work...

                  When the user clicks on the calendar (it's instance name is "calendar") it stores a global variable:

                  calendar.onRelease = function() {
                  _global.newpage = "calendar";
                  _level0.myMCL.loadClip("calendar.swf", 5);
                  }

                  Now, I need to send it through and if, else if, else if, etc. statement looking for the _global.newpage

                  This is the code for the else if for the calendar:

                  } else if (_global.newpage == "calendar") {
                  greenbar._y = -56.4;
                  greenbar._visible = true;
                  _global.newpage.enabled = false;
                  }

                  And, that code isn't working. Everything works except for the enabled = false line. What do I need to change that to so that it works?
                  • 6. Re: How can I found out which swf is loaded?
                    Rothrock Level 5
                    I don't know where everything in your file is located. But my code does work when you have the correct variable names. In the example I gave above, I assumed the button was named calendar_btn and it was on the main timeline of the movie loaded into _level5. Your milage may vary.

                    But if you are doing a bunch of else/if, then there is no reason to use the variable in the enabled line. (Also personally I never use buttons, so I don't know if it is enabled or enable. So you'd better check on that because you have shown it both ways.)

                    _level5.calendar.enabled=false;