Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jan 04, 2015 Jan 04, 2015

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

}

TOPICS
ActionScript
350
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 05, 2015 Jan 05, 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.

Translate
LEGEND ,
Jan 04, 2015 Jan 04, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 04, 2015 Jan 04, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 05, 2015 Jan 05, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 05, 2015 Jan 05, 2015
LATEST

Thank you very much sir for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines