15 Replies Latest reply: Oct 24, 2014 9:35 AM by resdesign RSS

    Problems loading JSON into Edge Animate

    QuadrantProductions Community Member

      Why when I load a JSON file do I get this problem.

       

      Inside the JSON File there is one object that needs to carry longer a longer text string that is going to be loaded into animate.  The loading is fine, everything is connecting correctly, the problem is the json file.

       

      The following are two identical json blocks of code.  I ran these as tests.  The first test loads fine.  The second doesn't.  Note the last line "biography" which is supposed to carry a lot of text and won't load.  Any ideas? Is this like in xml where you have to add some syntax for longer paragraphs?

       

       

      FIRST TEST LOADS

      [

        {

        "image" : "images/staff/cindy.jpg",

        "thename" : "Cindy",

        "thetitle" : "Registered Nurse",

        "certifications" : "CDA level 2, HARP Certified-RN",

        "biography" : "Short information here"

        }

      ]

       

      SECOND TEST IF I ADD ALL THE BIO DATA DOESN'T load

      [

        {

        "image" : "images/staff/cindy.jpg",

        "thename" : "Cindy",

        "thetitle" : "Registered Nurse",

        "certifications" : "CDA level 2, HARP Certified-RN",

        "biography" : "Long Bio here.  Behind the scenes, and supported by a fabulous team of professionals, Pat is responsible to for the day to day operations of the practice.

      Pat received her certification in 1968.  She joined the practice in 1992 after a long career in the dental industry including assisting, office management and as a corporate trainer and consultant to dental offices across Canada.  A past president of the Ontario Dental Assistants Association (ODAA) Pat was awarded the honor of a life time membership for her contribution to the growth and development of the ODAA and it’s members.  Pat is an avid traveler and enjoys live theatre, reading and music."

       

        }

      ]

        • 2. Re: Problems loading JSON into Edge Animate
          resdesign CommunityMVP

          Try to use html tag between the quotes  <br> for lines, etc.. You can use any tag with class names, id names, <style> etc... within the text.

          • 3. Re: Problems loading JSON into Edge Animate
            QuadrantProductions Community Member

            resdesign  like this?

             

             

            The testing site is meet-dr-pierre-miller

            It's just not working.  I'm noticing odd hiccups between the frames.  I have JSON files loading in on Timeline events which are supposed to replace the thumbs and corresponding data.  If I pull out the long text blocks it works.  The last one, loads flawlessly though… could it have something to do with caching the JSON?

            • 4. Re: Problems loading JSON into Edge Animate
              QuadrantProductions Community Member
              "biography" : "Long Bio here.  Behind the scenes, and supported by a fabulous team of professionals, Pat is responsible to for the day to day operations of the practice."<br>

              "Pat received her certification in 1968.  She joined the practice in 1992 after a long career in the dental industry including assisting, office management and as a corporate trainer and consultant to dental offices across Canada.  A past president of the Ontario Dental Assistants Association"<br>

              "(ODAA) Pat was awarded the honor of a life time membership for her contribution to the growth and development of the ODAA and it’s members.  Pat is an avid traveler and enjoys live theatre, reading and music."

               

               

               

              OR like this

               

              "biography" : "Long Bio here.  Behind the scenes, and supported by a fabulous team of professionals, Pat is responsible to for the day to day operations of the practice.<br>

              Pat received her certification in 1968.  She joined the practice in 1992 after a long career in the dental industry including assisting, office management and as a corporate trainer and consultant to dental offices across Canada.  A past president of the Ontario Dental Assistants Association. (ODAA) Pat was awarded the honor of a life time membership for her contribution to the growth and development of the ODAA and it’s members.  Pat is an avid traveler and enjoys live theatre, reading and music."

               

              Neither work.

              • 5. Re: Problems loading JSON into Edge Animate
                resdesign CommunityMVP

                1s - do not allow line breaks.

                Try this:

                 

                "biography" : "Long Bio here.  Behind the scenes, and supported by a fabulous team of professionals, Pat is responsible to for the day to day operations of the practice.<br>Pat received her certification in 1968.  She joined the practice in 1992 after a long career in the dental industry including assisting, office management and as a corporate trainer and consultant to dental offices across Canada.  A past president of the Ontario Dental Assistants Association. (ODAA) Pat was awarded the honor of a life time membership for her contribution to the growth and development of the ODAA and it’s members.  Pat is an avid traveler and enjoys live theatre, reading and music."

                • 6. Re: Problems loading JSON into Edge Animate
                  resdesign CommunityMVP

                  What I mean, after adding your html tags for <p> or <br>, delete all the breaks between line until you have only one long line in DW for example. then copy that text in the json file.

                  • 7. Re: Problems loading JSON into Edge Animate
                    resdesign CommunityMVP

                    Possible. Try to clear your cache.

                    • 8. Re: Problems loading JSON into Edge Animate
                      QuadrantProductions Community Member

                      AAAAhhhhh!  Thankyou.

                      I'm thinking about putting in some ajax to dump the cache problem.  Already though removing the line breaks is making it smoother.  Now I need a method to hide / show depending on whether there is a null reference.

                      I'm thinking something like

                       

                      if some textfield has null in it

                      hide the parent clip.

                       

                      That will be phase 2.

                      • 9. Re: Problems loading JSON into Edge Animate
                        resdesign CommunityMVP

                        Oh, great! 

                        Basically your text needs to look like it would look in Animate and you can see that line break gives an error.

                        sym.$('text').html("this is text

                        this is text");

                        gives an error

                        sym.$('text').html("this is text"

                        +" this is text");

                        is correct.

                        sym.$('text').html("this is text this is text");

                        is correct.

                        • 10. Re: Problems loading JSON into Edge Animate
                          QuadrantProductions Community Member

                          So for example if you had a text field element that was named "the name".  How would you tell animate if the value of the loaded json object was "null" hid the parent clip which is inside another symbol.

                           

                          Something like

                           

                          // if my element mySymbolInstanceName has the text "null" in it.

                          if (sym.getSymbol("mySymbolInstanceName").html("null") { //this is wrong syntax… not sure why

                              // hide the parent symbol

                              sym.getParentSymbol().css({"opacity":"0"});

                          }

                          else {

                             // do something entirely different

                          }

                          I'm sure my syntax is WAY off.

                          • 11. Re: Problems loading JSON into Edge Animate
                            QuadrantProductions Community Member

                            // if my element mySymbolInstanceName's

                            if (sym.getSymbol("teamgroup1")sym.$("teamThumb1").data("null") { // or is it more along this line?

                                // hide the parent symbol

                                sym.getParentSymbol().css({"opacity":"0"});

                            }

                            else {

                               // do something entirely different

                            }

                            • 12. Re: Problems loading JSON into Edge Animate
                              QuadrantProductions Community Member

                              The functionality I'm trying to change is demonstrated here.

                              meet-dr-pierre-miller

                              Show when you go to the Assissting tab that the last two thumbnail symbols don't have data.  They should be hidden

                              Also the hygiene tab has 3 which should be hidden.  I tried to manually hide them but it broke the entire thing.

                              • 13. Re: Problems loading JSON into Edge Animate
                                resdesign CommunityMVP

                                Here is how I handled it on a text on the stage and a button:

                                test if string is empty.zip - Box

                                 

                                var myText = sym.$('Text');

                                var nextBtn = sym.$('nextBtn');

                                myText.html('');

                                var test = ['here is text','','more text','still more text',''];

                                i=0;

                                myText.html(test[i]);

                                 

                                 

                                nextBtn.click(function(){

                                i++;

                                 

                                 

                                if (test[i]== null || test[i]==''){

                                // Hide an element

                                sym.$("Rectangle").css({'opacity':0.00});

                                //myText.html(test[i]);

                                }else{

                                sym.$("Rectangle").css({'opacity':1.00});

                                myText.html(test[i]);

                                }

                                 

                                 

                                });