5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:北京
性别:先生
最后登录:2014-08-29
http://veteran.5d.cn/
www.toswf.com
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/11/21 | Flash图片读取与展示(二)
类别(Flash)
|
评论
(0)
|
阅读(1021)
|
发表于 22:23
把制作的结构共享出来 大家研究一下,水平有限 这些了:
库的结构:
_root:下面的代码:
[upload=jpg]upload/2005-11/21_341.jpg[/upload
stop();
//Author:Veteran
//Blog:http://veteran.5dblog.com
//QQ:58260585
//MSN:veteran_nh@hotmail.com
//****************************
var parseXML:XML = new XML();
var picArray:Array = new Array();
var infoArray:Array = new Array();
var dateArray:Array = new Array();
System.useCodepage = true;
parseXML.ignoreWhite = true;
parseXML.load("Photo.xml");
parseXML.onLoad = function(success) {
if (success) {
parseDoc(this);
}
};
function parseDoc(doc:XMLNode) {
var len = doc.firstChild.childNodes.length;
for (var i = 0; i<len; i++) {
picArray.push(doc.firstChild.childNodes[i].attributes.pic);
infoArray.push(doc.firstChild.childNodes[i].attributes.info);
dateArray.push(doc.firstChild.childNodes[i].attributes.date);
}
}
MC下面的代码:
图片如下:
var mypro = this.createTextField("pro", this.getNextHighestDepth(), 0, 0, 100, 30);
mypro._visible = true;
function loadpic(picnum, clip) {
var myclip:MovieClipLoader = new MovieClipLoader();
var mylis:Object = new Object();
mylis.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
pro.text = int((bytesLoaded/bytesTotal)*100);
};
mylis.onLoadComplete = function() {
pic_1.setMask(mask);
//trace(pic_1._width);
mypro._visible = false;
};
myclip.addListener(mylis);
//trace(_root.picArray)
myclip.loadClip(picnum, clip);
}
picnum = "img/1.jpg";
_root.onEnterFrame = function() {
if (_root.picArray.length != 0) {
delete this.onEnterFrame;
for (var i = 0; i<_root.picArray.length; i++) {
pic_1.createEmptyMovieClip("pic"+i, i);
pic_1["pic"+i]._x = 138*i;
duplicateMovieClip(chpic, "chpic"+i, 100+i);
eval("chpic"+i)._x = 500;
eval("chpic"+i)._y = 10+i*20;
eval("chpic"+i).num = i+1;
eval("chpic"+i).onPress = function() {
dnum = this._name.substr(5, 1);
changePic(dnum*138);
};
loadpic("img/"+_root.picArray[i], pic_1["pic"+i]);
}
otherInfo(0);
}
};
function otherInfo(num) {
_root.info = _root.infoArray[num];
_root.date = _root.dateArray[num];
}
speed = 5;
function changePic(dnum) {
this.onEnterFrame = function() {
pic_1._x += (-dnum-pic_1._x)/speed;
};
otherInfo(dnum/138);
}
图片如下:
Photo.xml文件的结构:
<?xml version="1.0" encoding="gb2312" ?>
- <new>
<list pic="1.jpg" name="RunnerOne" info="This is a picture that describe a runner!" date="2005-11-8" />
<list pic="2.jpg" name="RunnerTwo" info="This is a picture that describe a runner!" date="2005-11-8" />
<list pic="3.jpg" name="RunnerThree" info="This is a picture that describe a runner!" date="2005-11-8" />
<list pic="4.jpg" name="RunnerFour" info="This is a picture that describe a runner!" date="2005-11-8" />
<list pic="5.jpg" name="RunnerFive" info="This is a picture that describe a runner!" date="2005-11-8" />
<list pic="6.jpg" name="RunnerSix" info="This is a picture that describe a runner!" date="2005-11-8" />
</new>
0
评论
Comments
日志分类
首页
[185]
Flash
[123]
ColdFusion
[2]
Flex
[2]
FlashMedia
[3]
RIA
[4]
Other
[43]
Python
[0]
Design
[8]