flash图片切换
flash图片切换,这里他有三action我分别列出来,还有一个aa.xml我们要用as分析xml文档把图片给flash 进行处理.先看flash三个动作的代码.
1
Stage.scaleMode = "noScale";
//Stage.align = "TL";
fscommand("showmenu", false);
System.useCodepage=true;
// Create a new XML object.
var xmlObj:XML = new XML();
// Set the ignoreWhite property to true (default value is false).
xmlObj.ignoreWhite = true;
// After loading is complete, trace the XML object.
xmlObj.onLoad = function(success) {
gotoAndPlay(3);
};
// Load the XML into the xmlObj object.
//xmlObj.load(picurl);
xmlObj.load("pic_list.xml");
stop();
_quality="best";
2
pic_show1._visible=true;
now=1;
function lik_see() {
var lik0=new Array();
for (i=1;i<n;i++) {
lik0.push({lik: this["pic_show"+i], depth: this["pic_show"+i].getDepth()});
}
lik0.sortOn("depth",16)
for (i=0;i<n;i++) {
lik0[i].lik._visible=false;
}
lik0[n-2].lik._visible=true;
lik0[n-3].lik._visible=true;
lik0[n-4].lik._visible=true;
lik0[n-5].lik._visible=true;
lik0[n-6].lik._visible=true;
jishi.gotoAndPlay(1);
}
caidan.caidan.left0.onRelease = function () {
now--;
if (now<1) now=n-1;
lik=_root["pic_show"+now]
lik._visible=true;
lik.swapDepths(m);
lik.gotoAndPlay(1);
caidan.caidan.caidantiao.back0._x=(now-1)*50
m++;
lik_see();
trace (now)
trace (lik)
trace (m)
}
caidan.caidan.right0.onRelease = function () {
now++;
if (now==n) now=1;
lik=_root["pic_show"+now]
lik._visible=true;
lik.swapDepths(m);
lik.gotoAndPlay(1);
caidan.caidan.caidantiao.back0._x=(now-1)*50
m++;
lik_see();
trace (now)
trace (lik)
trace (m)
}
stop();
好了,flash 的as我己全部贴出来了,现在我们来看xml 的格式吧.
<?xml version="1.0" encoding="gb2312"?>
<forums>
<forum>
<pic>1.jpg</pic>
<expline>美</expline>
<url>http://226500.cn</url>
</forum>
<forum>
<pic>2.jpg</pic>
<expline>美</expline>
<url>http://226500.cn</url>
</forum>
</forums>
好了就完了,我们只要图片路径对了就OK了,
补充:flash教程,As3.0