0 Replies Latest reply on May 21, 2015 7:30 AM by CPedrick

    Set and reference dynamic symbol ID

    CPedrick Level 1

      I need to create a number of symbols dynamically within another symbol and then set the position, height, etc. for each of the newly created symbols.

       

      I've read everything I can find and come up with this code to create a new instance of the symbol "blueRect" within the existing symbol on the stage called "Chart".

       

      for (i=0;i<3;i++) {


        //create new child symbol
        var NewSymbolInstance = sym.createChildSymbol("blueRect", "Chart");

       

        //create instance name for this new symbol

        NewSymbolInstance.element.attr("id","newIDName"+i);

       

        //set top position

        sym.getSymbol('#newIDName'+i).css ('top', 250);

       

      }

       

      When I run this code, it creates the first symbol instance and then throws this console message:

      SCRIPT5007: Unable to get property 'attr' of undefined or null reference

       

      so it seems  to be choking on the line that creates the instance name.

       

      All thoughts most greatly appreciated!!!!

      Carolyn