SteveH
06-14-2008, 06:12 PM
Hello
I am trying to get a newsfeed to work on a test MX 2004 Flash site here:
http://stevehigham59.7host.com/feed/news.html
I have used the script from an online tutorial and changed only the xml link to the BBC.
I am getting a 'connect failed' error message and I'm not sure why. I have an aspx file (which is fine), an FLA, and an external AS text file. Here is the script for it:
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[i];
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[i];
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();
/////////////////////////////////////////////////////
Is there anything obviously wrong here and, if not, what might cause me to get the error message?
Many thanks.
Steve
I am trying to get a newsfeed to work on a test MX 2004 Flash site here:
http://stevehigham59.7host.com/feed/news.html
I have used the script from an online tutorial and changed only the xml link to the BBC.
I am getting a 'connect failed' error message and I'm not sure why. I have an aspx file (which is fine), an FLA, and an external AS text file. Here is the script for it:
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[i];
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[i];
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();
/////////////////////////////////////////////////////
Is there anything obviously wrong here and, if not, what might cause me to get the error message?
Many thanks.
Steve