4 Replies Latest reply on Jul 21, 2015 9:07 AM by Zoze

    Targeting Parent of an event target object


      Hello, I'm used to working in AS3/Flash CC and I'm having trouble grasping the differences between targeting symbols and objects with Jquery/javascript and AS3..


      In this case I'm trying to dynamically create a "card" symbol on the stage (in this case "card2") and have it play a flipping animation using the nested label "flip" on click.

      So when I run this code I get errors. It seems that the target is a graphic element inside the card symbol and not the card symbol itself and console is telling me that there is no play function on the element. I tried using .parent() to target the card one level down but that doesn't seem to be working either.


      Can someone explain to me the best way to achieve this? Or why my code is throwing errors?


      var card3 = sym.createChildSymbol("card2", "Stage");

      var card3_n = card3.getSymbolElementNode();


      sym.$(card3_n).addClass("card"); //I'm adding a class of 'card' to my newly created card3.


      sym.$(".card").css({"cursor": "pointer"}); //I already have 2 card symbols placed on the stage named card1 and card2 with the .card class applied to them. The css here is working on them.

      sym.$(".card").on("click", clickHandler);


      function clickHandler(e)


        var theTarget = $(e.target);


        console.log('>> e target : ',theTarget);

        console.log('>> card3_n : ',card3_n);