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

Pass variables in symbols to function

$
0
0

I'd appreciate some quick help on how to pass a variable I set in a symbol to a function in the compositionReady code. 

 

Right now for each button in a menu I have the code: 

 

 

case 'item1':

sym.getComposition().getStage().clearStage();  //this is a function in compositionReady

sym.getComposition().getStage().getSymbol("object_details").$("item1") .show();

sym.getComposition().getStage().getSymbol("object_details").getSymbol( "item1").play(0);

break;

 

 

here is the code in compositionReady:

 

sym.clearStage = function() {

sym.getComposition().getStage().$("grid").hide();

sym.getComposition().getStage().$("othermaps").hide();

}

 

 

Is there a way to pass the value 'item1' to the function so that I'm not writing the same code over and over? 

Thus:

 

case 'item1':

sym.getComposition().getStage().clearStage("item1");

break;

 

 

and in compositionReady:

 

sym.clearStage = function(itemValue) {

sym.getComposition().getStage().$("grid").hide();

sym.getComposition().getStage().$("othermaps").hide();

sym.getComposition().getStage().getSymbol("object_details").$(itemValu e).show();

sym.getComposition().getStage().getSymbol("object_details").getSymbol( itemValue).play(0);

}

 

 

 

I know my syntax is totally wrong.  Please help me to see this.  Thank you. 


Viewing all articles
Browse latest Browse all 9897

Trending Articles



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