4 Replies Latest reply on Sep 19, 2014 10:36 AM by cre8ive1974

    Array execution with a function

    cre8ive1974

      I have a series of buttons on the screen and they all have some sort of animation associated with them.  All of these buttons are in a symbol titled "MainMenu"  I would like to create an array and place all the button names in the array.  Then using a function when you press any button on the menu all the buttons will stop animating.

       

      I put this on the stage under document.compositonReady action...

       

      var buttonReset = ["steelBTN", "glassBTN", "woodBTN", "waterBTN"];

      sym.resetGlobal=function(){

      for(i=0; i<buttonReset.length; i++){

      sym.getSymbol("MainMenu").getSymbol[buttonReset[i]].stop("off");

      }

      }


      And this is on the button under the click action...

      sym.getComposition().getStage().resetGlobal();

       

       

      when I don't use an array and just use this...

       

      sym.resetGlobal=function(){

      sym.getSymbol("MainMenu").getSymbol("steelBTN").stop("off");

      sym.getSymbol("MainMenu").getSymbol("glassBTN").stop("off");

      sym.getSymbol("MainMenu").getSymbol("woodBTN").stop("off");

      sym.getSymbol("MainMenu").getSymbol("waterBTN").stop("off");

      }

       

      ...everything works so I am thinking maybe I am not creating the array correctly in my first example?  Any help would be appreciated.

       

      Thanks in advance for the help.