网管联盟 | 网管论坛 | 网管u家 | 网管博客 | 网管软件 | 网管求职 | 小游戏 | 网管搜索 | 网管原创 | 网管聚合 | 网管读摘 | 网管焦点 | 世界素材 | 会员投稿 | 会员中心 
中国网管联盟
Windows Linux Cisco 网络技术 数据库 黑客攻防 DotNet Java PHP 认证 新闻资讯 服务器 存储资讯 网络设备 网管学堂 技术专题 焦点 网吧频道
 当前位置: > bitsCN.com > 网管学堂 > 网页设计 > Flash > 制作技巧 > Flash技巧:SWF图片切换效果  

Flash技巧:SWF图片切换效果

2006-05-02  作者:中国网管联盟  来源:BitsCN.com整理  点评 投稿 收藏

SWF定时读取外部图片和新闻标题
类似:http://games.sina.com.cn/ 
简单点,就使用xml+flash,可以直接修改xml
第一帧:
myid_num = new Array();
mytitle_num = new Array();
total = new Array();
System.useCodepage = true;
var myxml = new XML();
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(); 网管网www.bitscn.com
};
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;

网管u家u.bitscn@com


   trace(url2);
   getURL("javascript :MM_openBrWindow("+"’"+url2+"’"+",’_b’,’resizable=no,scrollbars=yes,width=600’)");
  };
 }
};
取名为"date.xml"的文件:
<?xml version=’1.0’ encoding=’UTF-8’?>
<data>
<newsid>
<project myid="1" mytitle="新闻1" />
<project myid="2" mytitle="新闻2" />
<project myid="3" mytitle="新闻3" />
</newsid>
</data>
 

TAGs切换   效果   图片   技巧   news   myid_num   total   this   function    
 上一篇:Flash贺卡制作创意方法漫谈   下一篇:Flash技巧:运用复制旋转命令轻松画图
Flash技巧:SWF图片切换效果 评论:
loading.. 评论加载中…
评论:请自觉遵守互联网相关政策法规,评论不得超过250字。

验证码: 注册用户
本类热门排行:
最新推荐文章:
网管论坛交流: