2 Replies Latest reply on Mar 7, 2008 12:19 PM by Newsgroup_User

    passing... out

    Walloompoom
      Why doesn't the text output work?

      If trace returns "lb2txt" then shouldn't this work? Isn't this[btnOntxt].text = 'Hello'; the same as lb2txt.text = 'Hello';

      btnOntxt = "lb2txt";

      this[btnOntxt].text = 'Hello';

      trace([btnOntxt]);
        • 1. Re: passing... out
          Walloompoom Level 1
          Ok, this works: _root.mainMc.navMc.navL[btnOntxt].text = 'Hello';

          Now the question is why doesn't this work?

          path = "_root.mainMc.navMc.navL.";
          btnOntxt = "lb2txt";
          [path+btnOntxt].text = 'Hello';

          • 2. Re: passing... out
            Level 7
            Walloompoom,

            > Now the question is why doesn't this work?
            >
            > path = "_root.mainMc.navMc.navL.";
            > btnOntxt = "lb2txt";
            > [path+btnOntxt].text = 'Hello';

            Because the array access operator doesn't work the way eval() does.
            When you use the array access operator, each section of the path, normally
            separated by a dot, must be couched in its own [] characters.

            _root["mainMc"]["navMc"].navL;
            this["mainMc"]["navMc"].navL;

            etc.


            David Stiller
            Co-author, Foundation Flash CS3 for Designers
            http://tinyurl.com/2k29mj
            "Luck is the residue of good design."