Skip to main content
shiko_89
Participant
January 4, 2015
Answered

.swf & .html files doesn't work while the .fla file works fine

  • January 4, 2015
  • 1 reply
  • 412 views

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);

}

This topic has been closed for replies.
Correct answer Ned Murphy

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.

1 reply

Ned Murphy
Legend
January 4, 2015

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?

shiko_89
shiko_89Author
Participant
January 5, 2015

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.

Ned Murphy
Ned MurphyCorrect answer
Legend
January 5, 2015

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.