16 Replies Latest reply on Nov 19, 2012 10:09 AM by kglad

    Cross Domain policiy issue...

    Karim Bizid

      Hi everyone,

       

      I'm having a cross domain policy issue and after struggling for two days straight... It's time to ask you

      guys for help.

       

      I'm creating a simple site where I want to show my last 5 tweets, but I have to mention that is't been years ago since

      I've made something in Flash and apperently al lot has changed since then.

       

      Let me show you what I've got:

       

      The AS:

       

      System.security.loadPolicyFile("http://drgroove.v7productions.nl/crossdomain.xml");

       

      var loadXML:XML = new XML();

          loadXML.ignoreWhite = true;

          loadXML.onLoad = processXML;

          loadXML.load("twitter.php"); //used when swf in placed on server

          loadXML.load("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=studiodrgroove");

       

          function processXML(loaded:Boolean)

          {

              if(loaded)

              {

       

                  var node = this.firstChild;

                  tweet_1.text = node.childNodes[0].childNodes[2].firstChild;

                  tweet_2.text = node.childNodes[1].childNodes[2].firstChild;

                  tweet_3.text = node.childNodes[2].childNodes[2].firstChild;

                  tweet_4.text = node.childNodes[3].childNodes[2].firstChild;

       

                  var follower_count = node.childNodes[9].childNodes[11].childNodes[9].firstChild;// Creates variable

                  trace(follower_count); //loads variable into output

       

                  follower_count_txt.text = follower_count;// show follower count in text box

       

              }

       

              else

              {

                  error_txt.text = "Error loading XML file";

              }  

       

                          for (i=0; i<follower_count; i++) // <-- problem occurs here

                              {

                              _root.attachMovie("tweep_mc", "tweep"+i+"_mc", i);

                              _root["tweep"+i+"_mc"]._x = 150 + random(500);

                              _root["tweep"+i+"_mc"]._y = 150 + random(500);

                              trace(i);

                              }

       

                          trace(i);

          }

       

          follow_btn.onRelease = function()

          {

              getURL("http:///twitter.com/studiodrgroove");

          }

       

      facebook_btn.onRelease = function()

          {

              getURL("http://www.facebook.com/pages/Studio-DR-Groove/415605851839285");

          }

       

       

       

      stop();

       

      The Crossdomain file

       

      <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

      <site-control permitted-cross-domain-policies="all"/>

      <cross-domain-policy>

      <allow-access-from domain="*twitter.com"/>

      <allow-access-from domain="*"/>

      <allow-access-from-domain="*.v7productions.nl"

      </cross-domain-policy>

       

      When I test the movie offline it works fine (even with Shift+CMD+Return I get no output errors), but on the server I have no

      result in the dynamic text box.

      Google doesn't get met helpfull files either...

      My brain is baked and I'm guessing I'm missing a simple thing that stocks this script from working.

       

      Hope you can help me out!

       

      Thanks in advance

       

      Karim