Copy link to clipboard
Copied
Hi I am new to actionscript and I have a question. The fla file works perfectly and runs the timer function and reads from the xml file to create a rss feed, but when I publish and choose HTML wrapper and choose Flash 14 the swf and html file loads the pictures and the text field but doesn't do anything else please help.
Thanks in advance.
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.text.TextField;
import flash.text.*;
import flash.utils.Timer;
import flash.events.TimerEvent;
var RSSLoader:URLLoader = new URLLoader();
var RSSURL:URLRequest = new URLRequest("http://sports.yahoo.com/soccer//rss.xml");
RSSLoader.addEventListener(Event.COMPLETE, RSSLoaded);
RSSLoader.load(RSSURL);
var RSSXML:XML = new XML();
RSSXML.ignoreWhitespace = true;
var title:TextField;
var desc:TextField;
var allText:TextField;
title = new TextField();
allText = new TextField();
var i:int;
function RSSLoaded(e:Event):void{
trace("xml file loads here");
RSSXML = XML(RSSLoader.data);
for(var selectedItems:String in RSSXML.channel.item){
title.text=(RSSXML.channel.item[selectedItems].title+" / ");
title.wordWrap = true;
tfLog.text+=title.text;
tfLog.wordWrap = true;
trace(title.text);
}
}
var t:Timer = new Timer(200);
t.addEventListener(
TimerEvent.TIMER,
function(ev:TimerEvent): void
{
tfLog.text= tfLog.text.substr(1)+tfLog.text.charAt(0);
}
);
t.start();
var picTimer:Timer = new Timer(2000);
picTimer.start();
picTimer.addEventListener(TimerEvent.TIMER, timehandler);
function timehandler(event:TimerEvent):void{
setChildIndex(getChildAt(7),0);
}
One way around that is to have a PHP file on your server that reads the xml feed and your swf reads the data from that PHP file rather than directly from the external domain.
Copy link to clipboard
Copied
What else should it be doing that it does not do? You say it loads the pictures and the text, so what portion of the code you show is failing?
Copy link to clipboard
Copied
well the pictures part I did it ok it was something in the publish settings, but the text field is supposed to display all the titles from the xml file from http://sports.yahoo.com/soccer//rss.xml. I searched on it and I found out that I cant display xml from another website something related to crossdomain is there anything around that?? Thank you for your reply.
Copy link to clipboard
Copied
One way around that is to have a PHP file on your server that reads the xml feed and your swf reads the data from that PHP file rather than directly from the external domain.
Copy link to clipboard
Copied
Thank you very much sir for your help.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now