Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Array execution with a function

$
0
0

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.


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>