5 Replies Latest reply on Oct 9, 2014 12:31 PM by joel_pau

    Creating childSymbol from JSON data

    Torben V.F.

      Hi

       

      This is a bit tricky one, i think.

       

      I am trying to make a menu, from some JSON data. I want to make a function, that takes, in this case the id (this is not to be confused with Javascripd id. This is just the name in the JSON file) and creating a symbol. But i don't want it to repeat itself. Right now, it only says placeholder, in those places, it shouldn't create a symbol at all.

      http://torbenvf.dk/ledelsehelehistorien/test/index.html

      Heres the code from the ComposisionReady

       

      (function($, Edge, compId){

      var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes

       

         //Edge symbol: 'stage'

         (function(symbolName) {

           

           

            Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {

               $.getJSON('slides.json', function(data) {

              

              

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

                       {

                  var s = sym.createChildSymbol("slide", "Stage");

              

              

              

                                   if(i)

                                       { if(repeat != data[i].id)

                                           {s.$("title").html(data[i].id);}

                                   else

                                       {}

              

               }

                                                           else{

                                       s.$("title").html(data[i].id);}

              

                                   repeat = data[i].id;

              

              

              

              

                       }

              

               });

              

       

            });

       

      Eventually, the whole thing is going to look something like this, just using dynamic data

      http://torbenvf.dk/ledelsehelehistorien/grafiskprototype1koma5.html

       

      Kind Regards