2 Replies Latest reply on Dec 1, 2012 9:45 AM by Krongaard

    How can I access nested symbol details such as offset and name dynamically

    Krongaard

      Hey friendly Edge Animate experts!

       

      I'm very new to Edge Animate, and appear to have run into some startup problems that I am unable to find a good way around.

       

      I have setup a small demo project with several levels, and am trying to get details from symbols on 2nd or 3rd level dynamically with little luck.

       

      To test that I fetch the correct details, and have the pathing correct, I have added a text option in each symbol.

      I can access and alter the value of the text fields - but I can't access the symbol data such as offset, position, ID, name etc.

       

      For simplicity, imagine a project with a symbol "FirstLevel" that has a symbol "SecondLevel" inside it.

      "SecondLevel" has three symbols that each have 2 text layers FirstTextField and SecondTextField  in addition to a symbol that has a png image.

       

      My code:

       

      // Get all the 3rd level symbols that I want to get details on (works perfectly)

      var childSymbols = sym.getComposition().getStage().getSymbol("FirstLevel").getSymbol("SecondLevel").getChild Symbols();

       

      // Loop through all the children (works perfectly)

      for(var i=0; i<childSymbols.length; i++){

       

      // Add the looping counter to a text field just to test if all is ok (works perfectly)

         childSymbols[i].$("FirstTextField").html(""+i)

       

      /*

      So... I can access the symbols, change a text without problems.

      Now i would like to get the symbol details such as offset().left or position().top

      and add that info to SecondTextField and I just can crack that nut!!!

      */

        childSymbols[i].$("SecondTextField").html(""+childSymbols[i].position().left); // not working

        childSymbols[i].$("SecondTextField").html("TEST VALUE"); // working, TEST VALUE is shown

       

      // Not working

      var ChildPos = sym.getSymbol(childSymbols[i]).position();

      childSymbols[i].$("SecondTextField").html(""+ChildPos.left);

       

      // Not working

        childSymbols[i].$("SecondTextField").html(""+getVariable(childSymbols[i]).position().left ));

       

      /*

      I have tried this and that for hours and hours

      I feel that i have searched high and low

      I must have tried all the wrong options

      But I'm still looking for the one correct way to do thi...

      */

       

      }

       

      Any help, tips, tricks or read-up directions would be much apreciated.