Flash技巧:SWF图片切换效果

王朝other·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

SWF定时读取外部图片和新闻标题

类似:http://games.sina.com.cn/

简单点,就使用xml+flash,可以直接修改xml

第一帧:

myid_num=newArray();

mytitle_num=newArray();

total=newArray();

System.useCodepage=true;

varmyxml=newXML();

myxml.ignoreWhite=true;

myxml.load("date.xml");

myxml.onLoad=function(success){

if(success){

loader._visible=false;

parseXML();

}else{

trace("XML加载失败!");

}

};

parseXML=function(){

total=myxml.firstChild.childNodes[0].childNodes;

for(i=0;i<total.length;i++){

myid_num[i]=total[i].attributes.myid;

mytitle_num[i]=total[i].attributes.mytitle;

}

shownews();

};

shownews=function(){

for(i=0;i<4;i++){

duplicateMovieClip(this.news,"news"+i,i);

this["news"+i]._x=13.5;

this["news"+i]._y+=5+i*23;

id1=myid_num[i];

title1=mytitle_num[i];

if(title1.length>=9){

title1=title1.substring(0,9)+"...";

}

//id2="0"+id1+".";

id2="※";

title2=id2+title1;

this["news"+i].txt=title2;

this["news"+i].onRelease=function(){

url1="http://football.ppn.cn/tnew.asp?id=";

id3=this._name.slice(4);

id4=myid_num[id3];

url2=url1+id4;

trace(url2);

getURL("javascript:MM_openBrWindow("+"’"+url2+"’"+",’_b’,’resizable=no,scrollbars=yes,width=600’)");

};

}

};

取名为"date.xml"的文件:

<?xmlversion=’1.0’encoding=’UTF-8’?>

<data>

<newsid>

<projectmyid="1"mytitle="新闻1"/>

<projectmyid="2"mytitle="新闻2"/>

<projectmyid="3"mytitle="新闻3"/>

</newsid>

</data>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航