2 Replies Latest reply on Mar 10, 2011 12:21 PM by Michael Maurel

    Access to MovieClip by name

    Michael Maurel



      Trying to develop a Monopoly in Flash/as3, I'm now displaying the properties of each player.

      When a user clicks on the userpanel, a "popup" appears, in wich all cards are displayed with an alpha = 0. My idea is to set the alpha at 1 for all the properties owned by the targeted user.


      So, I have a panel called "panelCards", containing movieclips called "property1", "property2", "property3", ...

      In my code, an object Player has an array "pProperty", wich contains strings referring to every properties owned. I try to access the moviclips using these strings :




      private function displayPropertyPanel(pTarget:Number){
          var tmpPCard:MovieClip = new panelCards();
          tmpPCard.x = 300;
          tmpPCard.y = 300;
          var tmpProp:Array = aPlayer[pTarget].getProperties();
          for(var i:int = 0; i < tmpProp.length; i++){
              tmpPCard.tmpProp[i].alpha = 1;



      Obviously, it doesn't work. Is there a function wich allows me accessing those movieclips with the string reference?