4 Replies Latest reply on Sep 25, 2008 5:29 AM by Newsgroup_User

    Cannot call functions with this[]

    Level 7
      Hello,

      I'm in trouble because I need to call functions from MCs with a variable
      name.

      I tried to use this[] that should do the trick, but it doesn't.

      Here's what I did in code to try to debug :

      - trace what's inside the this[]
      - the actual this[]
      - a cut and paste of the above trace() with the function call

      Of course, both "hardcoded" calls work..; what am I doing wrong ?

      Here's the code :

      trace(_parent + "." + buttonName);
      trace("_parent." + buttonName);
      this[_parent + "." + buttonName].setBtnState("test1");
      this["_parent." + buttonName].setBtnState("test2");
      _parent.mcBtn1.setBtnState("test3");
      _level0.mcInt.mcBtn1.setBtnState("test4");


      What am I supposed to feed this[] with ? Path as a string ?

      Thanks in advance.

      PJ