Quantcast
Viewing all articles
Browse latest Browse all 85594

Re: Referencing symbols from symbol elements

In case this helps anyone else, I finally achieved what i outlined above using the code below. The stage holds a symbol called allButtons, which holds two symbols, Button1 and Button2. The symbol elements of these are the click targets, and have the class btnClicka.

 

$(".btnClicka").on("click", function(e){

  var targetID = e.currentTarget.id;

  var buttonClicked = targetID.charAt(targetID.length-1);

  console.log("click " + buttonClicked);

  sym.getComposition().getStage().getSymbol("allButtons").getSymbol("Button" +buttonClicked).stop("Touch");

 

});


To me, this does not seem like an elegant solution; is it necessary to go all the way out to the stage and back in again to target what I want, when it's only one step away from where I started. Seems like walking round the block to visit the house next door. If anyone knows the shorter/ clever way to do this, I would love to know.


Viewing all articles
Browse latest Browse all 85594

Trending Articles



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