把制作的结构共享出来 大家研究一下,水平有限 这些了:
库的结构:
_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>
库的结构:
_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>
回复Comments
作者:
{commentrecontent}