3 Replies Latest reply on May 19, 2007 11:06 AM by jawwinker

    Assigning a variable to a variable.

    jawwinker Level 1
      Hello,

      I can't seem to figure out why I cannot assign the _visibility to the variable tempPath. I'm sure this is super simple, and I'm just missign somthing obvious, but it is driving me nuts. Anyone have any insight into this? Any help is greatly appreciated.

      Thanks
      Steve
        • 1. Re: Assigning a variable to a variable.
          Level 7
          tempPath has a value of a string, which to flash, is just a bunch of ASCII
          characters. You can't assign a _visible property to a bunch of characters.
          What you need is a reference to the movie clip those characters represent
          the path to. For that, you can use

          tempPath = _root.main["submenu" + x];

          Then tempPath equals a reference to the object in _root.main with the name
          "submenu" + x. As a reference to that object, you can use it to set the
          _visible property to that reference


          "jawwinker" <webforumsuser@macromedia.com> wrote in message
          news:f2lgjq$n1d$1@forums.macromedia.com...
          > Hello,
          >
          > I can't seem to figure out why I cannot assign the _visibility to the
          > variable
          > tempPath. I'm sure this is super simple, and I'm just missign somthing
          > obvious, but it is driving me nuts. Anyone have any insight into this?
          > Any
          > help is greatly appreciated.
          >
          > Thanks
          > Steve
          >
          > for (var x = 0; x < menuArray.length; x++) {
          > tempPath = ("_root.main.submenu" + x);
          > tempPath._visible = false;
          > }
          >


          • 2. Re: Assigning a variable to a variable.
            jawwinker Level 1
            That worked like a charm! Thanks Trevor!

            Steve
            • 3. Assigning a variable to a variable.
              jawwinker Level 1
              Hello,

              So now, I think that I'm having a similar problem with this code. I'm working on tempPath3 which is a variable that contains a movie clip that I want to turn on. I tried using a method similar to what you had mentioned before, but it isn't working. I traced the output of the variable, and it looks like it is named correctly, and I did a "hard code" test where I just entered some of the movie clip names by hand and they worked great. I can't seem to find where the rub is on this one. Any ideas?

              Thanks!

              Steve