论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Flash教程
Tag:flash cs,flash 8,鼠绘,as,手绘,工具,文字,loading,入门,初学,mc,影片剪辑,声音,mtv,游戏,引导,遮罩,菜单,补间,广告条,时钟,视频教程

图片的轮播效果

文章类别:Flash | 发表日期:2008-9-21 19:41:57

  最近做了一些图片轮播的效果跟大家分享一下。其实也只是一个方法,希望能够给其它朋友一点启发。
点击浏览该文件
先看一下,XML的部分。

<?xml version=’1.0’ encoding=’UTF-8’?>
<data>
<web>
<project name="01" title="体育快讯" word="马刺力拔活塞夺得总冠军 邓肯收获MVP费德勒三连霸气势如虹"intro="U338P6T12D1645697F44DT20050703061154.jpg" link="http://v.sportscn.com/vod/sp/card.asp" spic="http://image.sportscn.com/center/stock/2005/7/4/1120454819_m2.jpg";/’" target="_blank" >http://image.sportscn.com/center/stock/2005/7/4/1120454819_m2.jpg"/>
<project name="02" title="体育快评" word="马刺力拔活塞夺得总冠军 邓肯收获MVP费德勒三连霸气势如虹"intro="U338P6T12D1673211F44DT20050718165258.jpg" link="http://v.sportscn.com/vod/inside2_4.asp" spic="http://image.sportscn.com/center/stock/2005/7/19/1121732953_m1.jpg";/’" target="_blank" >http://image.sportscn.com/center/stock/2005/7/19/1121732953_m1.jpg"/>
<project name="03" title="体育娱乐" word="马刺力拔活塞夺得总冠军 邓肯收获MVP费德勒三连霸气势如虹"intro="U687P6T12D1645671F44DT20050703053111.jpg" link="http://v.sportscn.com/vod/inside2_3.asp" spic="http://image.sportscn.com/center/stock/2005/7/13/1121246777_s2.jpg";/’" target="_blank" >http://image.sportscn.com/center/stock/2005/7/13/1121246777_s2.jpg"/>
</web>
</data>

这点也没什么好讲的,要害是要最后保存的时候记得存成UTF-8,以下为FLASH的部分。

//XML读入
infoDefault = "";
showSrc = "";
nowBtnName = "no";
nowNum = 0;
xmlObj = new XML();
xmlObj.ignoreWhite = true;
xmlObj.load("pic.xml");
//XML文件所在地址
xmlObj.onLoad = function(success) {
if (success) {
trace("XML加载成功!");
parseXML();
//分析XML文件的函数
} else {
trace("XML加载失败!");
}
};
//建立以便装载XML中的数据
arr_web = new Array();
//分析XML文件
function parseXML() {
web = xmlObj.firstChild.childNodes[0].childNodes;
for (var i = 0; i<web.length; i++) {
arr_web[i] = new Object();
trace(web[i].attributes.word);
trace(web[i].attributes.title);
trace(web[i].attributes.intro);
trace(web[i].attributes.link);
trace(web[i].attributes.spic);
_root.spic["pic"+(i+1)].mc.loadMovie(web[i].attributes.spic);
_root["mc"+(i+1)].mc.mcl.loadMovie(web[i].attributes.intro);
//图片的载入
if (_root.spic["pic"+(i+1)].mc.getBytesLoaded() == _root.spic["pic"+(i+1)].mc.getBytesTotal()) {
_root["l"+(i+1)]._visible = 0;
} else {
_root["l"+(i+1)]._visible = 1;
}
if (_root.mc1.mc.mcl.getBytesLoaded() == _root.mc1.mc.mcl.getBytesTotal()) {
_root.loading._visible = 0;
} else {
_root.loading._visible = 1;
}
_root["mc"+(i+1)].Url = web[i].attributes.link;
_root["title"+(i+1)].text = web[i].attributes.title;
_root["word"+(i+1)].text = web[i].attributes.word;
_root["mc"+(i+1)].onPress = function() {
link = this.Url;
trace(this.Url);
getURL(link, "_blank");
};
}
}
title1.textColor = 0x000000;
mc3._visible = 0;
mc2._visible = 0;
c3._visible = 0;
c2._visible = 0;
var tvk = mc1;
var tvd = c1;
b1.onPress = function() {
time = 0;
title1.textColor = 0x000000;
title2.textColor = 0xFF6600;
title3.textColor = 0xFF6600;
if (tvk != mc1) {
changecolor2(tvk, 100);
cddh(tvd, 100);
}
changecolor(mc1, 0);
addh(c1, 0);
tvk = mc1;
tvd = c1;
};
b2.onPress = function() {
time = 100;
title2.textColor = 0x000000;
title1.textColor = 0xFF6600;
title3.textColor = 0xFF6600;
if (tvk != mc2) {
changecolor2(tvk, 100);
cddh(tvd, 100);
}
changecolor(mc2, 0);
addh(c2, 0);
tvk = mc2;
tvd = c2;
};
b3.onPress = function() {
time = 200;
title3.textColor = 0x000000;
title2.textColor = 0xFF6600;
title1.textColor = 0xFF6600;
if (tvk != mc3) {
changecolor2(tvk, 100);
cddh(tvd, 100);
}
changecolor(mc3, 0);
addh(c3, 0);
tvk = mc3;
tvd = c3;
};
function addh(mk, ck) {
mk._visible = 1;
mk._yscale = 0;
mk.onEnterFrame = function() {
if (mk._yscale<100) {
mk._yscale += 20;
trace("OKL!");
} else {
break;
}
};
}
function cddh(md, cd) {
md._yscale = 100;
md.onEnterFrame = function() {
if (md._yscale>0) {
md._yscale -= 20;
} else {
md._visible = 0;
trace("visible=0");
break;
}
};
}
function changecolor(mk, ck) {
mk._visible = 1;
mk._alpha = ck;
mk.onEnterFrame = function() {
mk._alpha += 20;
};
}
function changecolor2(md, cd) {
md._alpha = cd;
md.onEnterFrame = function() {
if (md._alpha>0) {
md._alpha -= 20;
} else {
md._visible = 0;
}
};
}
time = 0;
_root.onEnterFrame = function() {
time++;
if (time == 300) {
title1.textColor = 0x000000;
title3.textColor = 0xFF6600;
title2.textColor = 0xFF6600;
changecolor2(tvk, 100);
changecolor(mc1, 0);
changecolor(c1, 0);
changecolor2(tvd, 100);
tvk = mc1;
tvd = c1;
time = 0;
} else if (time == 100) {
title2.textColor = 0x000000;
title3.textColor = 0xFF6600;
title1.textColor = 0xFF6600;
changecolor2(tvk, 100);
changecolor(mc2, 0);
changecolor(c2, 0);
changecolor2(tvd, 100);
tvk = mc2;
tvd = c2;
} else if (time == 200) {
title3.textColor = 0x000000;
title2.textColor = 0xFF6600;
title1.textColor = 0xFF6600;
changecolor2(tvk, 100);
changecolor(mc3, 0);
changecolor(c3, 0);
changecolor2(tvd, 100);
tvk = mc3;
tvd = c3;
}
};
上一篇:{应用}AS编写三维环视效果 人气:1291
下一篇:{应用}移动时的模糊效果 人气:2447
视频教程列表
文章教程搜索
 
Flash推荐教程
Flash热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058