1 Reply Latest reply on Oct 8, 2012 8:18 AM by roti62

    xhr call does not work in Edge Animate 1.0?

    roti62

      I am a developer of weather apps and worked a lot with Flash and HTML 5. Now I am testing the Animate thing on Adobe's cloud.

       

      Here is my problem:

       

      I am trying to call a txt file from my server within an Animate composition. However, I did not get the response text.

       

      On Stage I placed the global variables in order to access them from any symbol timeline or any trigger function;

       

      MY_XHR                         = new XMLHttpRequest();

      MY_FILE_LOCATION     = "http://myserver.com/myfiles/init_stuff.txt";

      MY_RESPONSETEXT     = "";

       

      On Stage > onCompositionReady I placed this function

       

      sym.init_myStuff = function(){

           MY_XHR.onreadystatechange = function(){

                if(MY_XHR.readyState      == 4){

                     MY_RESPONSETEXT           = MY_XHR.responseText;

                     alert(MY_RESPONSETEXT)

                }

           }

           MY_XHR.open("GET",MY_FILELOCATION,true);

           MY_XHR.send();

      }

       

      In an action of a symbols timeline I finally placed

       

      sym.getComposition().getStage().init_myStuff();

       

      I get the alert window (so there is no problem with the general idea), but without the expected text.

       

      Knowing that the problem always lies between my ears, I appreciate any idea what is wrong.

       

      Thx a lot for your help.

        • 1. Re: xhr call does not work in Edge Animate 1.0?
          roti62 Level 1

          This drived me crazy, but finally - solved:

           

          It was a same-policy-issue. The txt file is located at www.mydomain1.com and the anination is located at www.mydomain2.com. Trying to call mydomain1 from mydomain2 does not work.

          When I included the txt file into the animation folder at www.mydomain2.com everything works fine.

           

          So make sure to include all external files into your aninamtion's server directory.

           

          PS: This was also the reason why interactions with an added iframe were not possible in FF, IE9 and Opera. After putting the HTML pages on the same directory the iframe worked as expected. As I said: the problem is always between my ears...