2 Replies Latest reply on Jun 17, 2008 7:43 AM by SteveH59

    News feed

    SteveH59 Level 1
      Hello

      What would be the best way to display live news on my MX 2004 site using:

      http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml

      The user would need to be able to click on a link, opening another browser, if they wishes to read the news item in full.

      Many thanks

      Steve
        • 1. Re: News feed
          Level 7
          There is no 'best way'. You can use the XML class to read the xml, and then
          do what you want with it...

          --
          Dave -
          www.offroadfire.com
          Head Developer
          http://www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          • 2. Re: News feed
            SteveH59 Level 1
            Thanks for your reply.

            This is the AS I am using from a tutorial on MX 2004, but I am getting a connection failed message:

            function set_gStyles(){
            tStyle = new TextFormat();
            tStyle.font = "verdana";
            tStyle.color = parseInt("ffffff",16);
            tStyle.leftMargin = 5;
            }

            function chk_server_conn(){
            _root.createTextField("item_text",0,0,(_root["newsitem_text"]._y)+23,300,16);
            tStyle.size = 10;
            _root["item_text"].selectable = false;
            _root["item_text"].text = "Checking Server Connection";
            _root["item_text"].setTextFormat(tStyle);
            }

            function showErrMsg(){
            tStyle.size = 10;
            _root["item_text"].text = "Connection Failed";
            _root["item_text"].setTextFormat(tStyle);
            }

            function make_header(){
            _root.createEmptyMovieClip ("headerbg", -1);
            with (_root["headerbg"]){
            beginFill (0x284E75);
            lineStyle (.5, 0x333333, 100);
            moveTo (0, 0);
            lineTo (0, 23);
            lineTo (450, 23);
            lineTo (450, 0);
            endFill();
            }

            _root["headerbg"].createTextField("header",110,0,0,300,16);
            _root["headerbg"]["header"].text = "BBC Internet News";
            _root["headerbg"]["header"].type = "static";
            _root["headerbg"]["header"].selectable = false;
            _root["headerbg"]["header"].autoSize = "left";
            tStyle.size = 14;
            _root["headerbg"]["header"].setTextFormat(tStyle);
            }

            function make_newsitem(){
            _root.createEmptyMovieClip ("news_item", -20);
            with (_root["news_item"]){
            moveTo (0, 10);
            beginFill (0x336699);
            moveTo (0, 23);
            lineTo (0, 40);
            lineTo (450, 40);
            lineTo (450, 23);
            endFill();
            }
            }

            function makeList(tAry,uAry){
            for (var i=0,j=1;i<uAry.length;i++,j++){
            duplicateMovieClip(_root["news_item"],"news_item"+i,i);
            _root["news_item"+i]._y = (_root["news_item"]._y + ((_root["news_item"]._height-1) * i));
            _root.createTextField("item_text"+i,j*10,0,(_root["news_item"+i]._y)+24,300,14);
            this["news_item"+i].theUrl=uAry ;
            this["news_item"+i].item_index = i;
            this["item_text"+i].selectable = false;
            this["item_text"+i].autoSize = "left";
            this["item_text"+i].text=tAry
            ;
            tStyle.size = 10;
            this["item_text"+i].setTextFormat(tStyle);


            this["news_item"+i].onRollOver = function(myColor){
            var myBg = new Color(this);
            myBg.setRGB(parseInt("aaaaaa",16));
            var myFontColor = new Color(_root["item_text"+this.item_index]);
            myFontColor.setRGB(parseInt("333333",16));
            }


            this["news_item"+i].onRollOut = function(){
            var myBg = new Color(this);
            myBg.setRGB(parseInt("336699",16));
            var myFontColor = new Color(_root["item_text"+this.item_index]);
            myFontColor.setRGB(parseInt("ffffff",16));
            }

            this["news_item"+i].onRelease = function(){
            getURL(this.theUrl,"_blank");
            }
            }
            }

            function get_news(){
            ret = new LoadVars();
            ret.onLoad = function(success){
            if(success){
            ret.myUrlAry = ret.theUrls.split('|');
            ret.myTitleAry = ret.theTitles.split('|');

            makeList(ret.myTitleAry,ret.myUrlAry);
            } else {
            showErrMsg();
            }
            }

            // load the values from "getNews.aspx"
            ret.load("getNews.txt");
            }

            function init(){
            set_gStyles();
            chk_server_conn();
            make_newsitem();
            make_header();
            get_news();
            }

            init();

            What do you think might be wrong?

            Thanks.

            Steve