2 Replies Latest reply on Sep 24, 2014 5:06 AM by resdesign

    Acces element in a ChildSymbol created progamatically

    Benoit Leray Level 1

      Hi,

       

      after hours reading API and forums, I'm still stuck doing the following.

       

      First I create Child Symbol of order in my Symbol Content which in on main comp.

      sym.getComposition().getStage().createChildSymbol("order", "content");

       

      In my Child Symbol order I got a div element named step1 I would like to get control on.

       

        sym.getComposition().getStage().getSymbol("content").children("order").$("step1").html('m y Text');

       

      What is the common path to access ChildElement create by creatChildSymbol ?

       

      Thanks .createChildSymbol

        • 1. Re: Acces element in a ChildSymbol created progamatically
          Siva. Level 3

          Dynamically created objects return their reference. You can use them later.

           

          // Creates an instance of  "order" inside "content"

          var order_inst1 = sym.getComposition().getStage().createChildSymbol("order", "content");


          // "step1" is an element of order_inst1

          order_inst1.$("step1").html('m y Text');

          1 person found this helpful
          • 2. Re: Acces element in a ChildSymbol created progamatically
            resdesign Adobe Community Professional & MVP

            Hello,

            The way that has worked for me is to assign a new id to the element. For  example I have a symbol called 'button'. I create it on the Stage then I assign an id to it. Then I can use the symbol with the new ID with the # in front of it.

             

                var button = sym.createChildSymbol("button", "Stage");   

                button.element.attr("id","newButton");

                sym.$('#newButton').css({

                    "position"            :"absolute",

                    "top"                 :Pos[i].y,

                    "left"                :Pos[i].x,

                    'cursor'                :'pointer'

                });

            1 person found this helpful