Skip to main content
Participant
September 5, 2012
Question

Publishing swf file with xml feed

  • September 5, 2012
  • 1 reply
  • 1359 views

I am working in actionscript 3 trying to create a flash banner ad that will be put on multiple sites.  The ad will grab a rss feed and display a number from that feed insie the banner ad.  The Flash file works fine on my local computer when I test it.  The feed is showing up just fine in the ad.  When I publish the ad for the web and test it out on my server, the feed does not display in the ad.  I have checked to make sure network access is selected in the publish settings.  I also have a crossdomain.xml policy file on the server with the feed.  My server is listed in the policy to allow access.  I keep thinking I am overlooking something, but can't figure it out.  Any help would be greatly appreciated.

Here is the code for the action script:

var rssLoader:URLLoader = new URLLoader();

var rssURL:URLRequest =

         new URLRequest("http://www.rssfeed.com/rssfeed");

rssLoader.addEventListener(Event.COMPLETE, rssLoaded);

rssLoader.load(rssURL);

var rssXML:XML = new XML();

rssXML.ignoreWhitespace = true;

function rssLoaded(e:Event):void{

    var rssXML:XML=new XML(e.target.data);

trace (rssXML);

    if (rssXML.channel.item[0].description >= 61)

        {rssXML.channel.item[0].description="60+"}

        testXML.text=rssXML.channel.item[0].description;

}

Here is the crossdomain.xml policy file:

<?xml version="1.0"?>

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

        <cross-domain-policy>

        <allow-access-from domain="domain.net"/>

        <allow-access-from domain="www.domain.net"/>

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

        <allow-access-from domain="www.anotherdomain.com"/>

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

        <allow-access-from domain="www.yetanotherdomain.com>"/>

        </cross-domain-policy>

Message was edited by: WRGrun262

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 5, 2012

try:

Security.loadPolicyFile("http://www.rssfeed.com/crossdomain.xml");

var rssLoader:URLLoader = new URLLoader();
var rssURL:URLRequest =
         new URLRequest(http://www.rssfeed.com/rssfeed);
rssLoader.addEventListener(Event.COMPLETE, rssLoaded);
rssLoader.load(rssURL);

var rssXML:XML = new XML();
rssXML.ignoreWhitespace = true;

function rssLoaded(e:Event):void{
    var rssXML:XML=new XML(e.target.data);

trace (rssXML);

    if (rssXML.channel.item[0].description >= 61)
        {rssXML.channel.item[0].description=60+}

        testXML.text=rssXML.channel.item[0].description;
}

this should be crossdomain.xml in the rssfeed.com root directory

<?xml version="1.0"?>


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


        <cross-domain-policy>

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

<allow-access-from domain="domain.net"/>         <allow-access-from domain="www.domain.net"/>         <allow-access-from domain="anotherdomain.com"/>         <allow-access-from domain="www.anotherdomain.com"/>         <allow-access-from domain="yetanotherdomain.com>/>         <allow-access-from domain="www.yetanotherdomain.com>/>         </cross-domain-policy>

Message was edited by: WRGrun262

WRGrun262Author
Participant
September 5, 2012

kglad,

     Thank you for the reply.  Turns out there was typo in the xml file.  The person uploading the file to the server had made a modification to the file and inadvertantly deleted part of the word "domain".  He fixed the typo and everything is working now. 

kglad
Community Expert
Community Expert
September 5, 2012

you're welcome.