3 Replies Latest reply on May 20, 2015 1:54 PM by markerline

    How to dynamically create a symbol within another symbol

    CPedrick

      I have a symbol called "Chart" on the Stage and referenced like this:

       

      var chart = sym.getSymbol("Chart");

       

      I have a library symbol called "blueRect"that contains a single element called "bar".

       

      I want to create an instance of "blueRec"t within the Chart symbol and then set various properties of the "bar" element.

       

      The following code works great to create a symbol on the Stage, but as soon as I change "Stage" to "chart" to try to create it within the chart symbol, it does not work. (The code runs, but nothing appears to happen.)

       

      var pmt1 = sym.createChildSymbol("blueRect","Stage");

      pmt1.$("bar").css ('height', 100);

      pmt1.$("bar").css ('width', 25);

      pmt1.$("bar").css ('top', 50);

      pmt1.$("bar").css ('left', 25);

       

      I am sure it is probably a stupid syntax error... All assistance greatly appreciated!

       

      Carolyn