永发信息网

FLASH中的AS2问题。

答案:2  悬赏:10  手机版
解决时间 2021-07-17 13:23

下面的代码默认是运行的时候不显示第一张大图,我想把它改为运行的是时候默认显示第一张大图片。代码怎么改。最好能把修改好的直接发布出来。

AS代码:

picData = new XML();
picData.ignoreWhite = true;
picData.onLoad = loadXML;
picData.load("xmlArtData.xml");
function loadXML() {
runScript();
}
function runScript() {
_root.createEmptyMovieClip("bg", 1);
_root.createEmptyMovieClip("image", 3);
_root.createEmptyMovieClip("thumbnails", 2);
images = new Array();
for (i=0; picData.firstChild.childNodes[i].firstChild.nodeValue != undefined; i++) {
images.push(picData.firstChild.childNodes[i].firstChild.nodeValue);
}
thumbnails._x = 350;
thumbnails._y = 375;
imageLoading = true;
numObjects = images.length;
objectsInScene = new Array();
focalLength = 800;
spin = 0;
_root.thumbnailSize = 125/((numObjects)/10);
displayPane = function () {
var angle = this.angle+spin;
var x = Math.cos(angle)*this.radius;
var z = Math.sin(angle)*this.radius;
var y = this.y;
var scaleRatio = focalLength/(focalLength+z);
this._x = x*scaleRatio;
this._y = y*scaleRatio;
this._xscale = -(this._yscale=100*scaleRatio);
this._xscale *= Math.sin(angle);
this.swapDepths(Math.round(-z));
};
angleStep = 2*Math.PI/numObjects;
for (i=0; i<numObjects; i++) {
thumbnail = thumbnails.createEmptyMovieClip("thumbnail_"+i, i);
myPic = thumbnail.createEmptyMovieClip("picHolder", 1);
myPic.loadMovie(images[i]);
thumbnail.angle = angleStep*i;
thumbnail.radius = 300;
thumbnail.x = Math.cos(thumbnail.angle)*thumbnail.radius;
thumbnail.z = Math.sin(thumbnail.angle)*thumbnail.radius;
thumbnail.y = 40;
thumbnail.display = displayPane;
thumbnail.drawBox(_root.thumbnailSize);
thumbnail.buttonize(i);
thumbnail.notLoaded = true;
objectsInScene.push(thumbnail);
}
panCamera = function () {
spin -= this._xmouse/40000;
for (var i = 0; i<objectsInScene.length; i++) {
objectsInScene[i].display();
}
};
thumbnails.onEnterFrame = panCamera;
_root.onEnterFrame = function() {
for (i=0; i<images.length; i++) {
if ((_root.thumbnails["thumbnail_"+i].picHolder.getBytesLoaded()/_root.thumbnails["thumbnail_"+i].picHolder.getBytesTotal() == 1) && _root.thumbnails["thumbnail_"+i].notLoaded) {
if (_root.thumbnails["thumbnail_"+i].picHolder._width>=_root.thumbnails["thumbnail_"+i].picHolder._height) {
_root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_"+i].picHolder._width-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._width)));
_root.thumbnails["thumbnail_"+i].picHolder._y = (_root.thumbnailSize-_root.thumbnails["thumbnail_"+i].picHolder._height)/2;
}
if (_root.thumbnails["thumbnail_"+i].picHolder._width<=_root.thumbnails["thumbnail_"+i].picHolder._height) {
_root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_"+i].picHolder._height-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._height)));
_root.thumbnails["thumbnail_"+i].picHolder._x = (_root.thumbnailSize-_root.thumbnails["thumbnail_"+i].picHolder._width)/2;
}
if (_root.thumbnails["thumbnail_"+i].picHolder._width == _root.thumbnails["thumbnail_"+i].picHolder._height) {
_root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_"+i].picHolder._width-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._width)));
_root.thumbnails["thumbnail_"+i].picHolder._x = _root.thumbnails["thumbnail_"+i].picHolder._y=0;
}
_root.thumbnails["thumbnail_"+i].picHolder._alpha = 60;
_root.thumbnails["thumbnail_"+i].notLoaded = false;
}
if ((_root.thumbnails["thumbnail_"+i].picHolder.getBytesLoaded()/_root.thumbnails["thumbnail_"+i].picHolder.getBytesTotal()<1)) {
}
}
if (_root.image.getBytesLoaded()/_root.image.getBytesTotal() == 1) {
if (imageLoading == true) {
_root.image._alpha = 0;
if (_root.image._width>_root.image._height) {
_root.image._yscale = _root.image._xscale=(100*(1-(_root.image._width-400)/_root.image._width));
}
if (_root.image._height>_root.image._width) {
_root.image._yscale = _root.image._xscale=(100*(1-(_root.image._height-400)/_root.image._height));
}
if (_root.image._height == _root.image._width) {
_root.image._yscale = _root.image._xscale=(100*(1-(_root.image._height-400)/_root.image._height));
}
_root.image._x = (725-_root.image._width)/2;
_root.image._y = (425-_root.image._height);
imageLoading = false;
}
_root.image._alpha += 5;
if (image._alpha>100) {
image._alpha = 100;
}
}
};
}
MovieClip.prototype.buttonize = function(num) {
this.onPress = function() {
imageLoading = true;
_root.image.removeMovieClip();
_root.createEmptyMovieClip("image", 3);
_root.image.loadMovie(images[num]);
};
this.onRollOver = function() {
this.picHolder._alpha = 100;
};
this.onRollOut = function() {
this.picHolder._alpha = 60;
};
};
MovieClip.prototype.drawBox = function(boxSize) {
this.lineStyle(1, 0x000000, 0);
this.beginFill(0x000000, 100);
this.lineTo(boxSize, 0);
this.lineTo(boxSize, boxSize);
this.lineTo(0, boxSize);
this.lineTo(0, 0);
this.endFill();
};

XML代码:

<?xml version="1.0"?>
<paintings>
<image>flashimg/1.jpg</image>
<image>flashimg/2.jpg</image>
</paintings>

最佳答案
picData = new XML();picData.ignoreWhite = true;picData.onLoad = loadXML;picData.load("xmlArtData.xml");function loadXML() { runScript();}function runScript() { _root.createEmptyMovieClip("bg",1); _root.createEmptyMovieClip("image",3); _root.createEmptyMovieClip("thumbnails",2); images = new Array(); for (i=0; picData.firstChild.childNodes[i].firstChild.nodeValue != undefined; i++) { images.push(picData.firstChild.childNodes[i].firstChild.nodeValue); } thumbnails._x = 350; thumbnails._y = 375; imageLoading = true; _root.image.loadMovie(images[0]);//fishcouldfly numObjects = images.length; objectsInScene = new Array(); focalLength = 800; spin = 0; _root.thumbnailSize = 125/((numObjects)/10); displayPane = function () { var angle = this.angle+spin; var x = Math.cos(angle)*this.radius; var z = Math.sin(angle)*this.radius; var y = this.y; var scaleRatio = focalLength/(focalLength+z); this._x = x*scaleRatio; this._y = y*scaleRatio; this._xscale = -(this._yscale=100*scaleRatio); this._xscale *= Math.sin(angle); this.swapDepths(Math.round(-z)); }; angleStep = 2*Math.PI/numObjects; for (i=0; i<numObjects; i++) { thumbnail = thumbnails.createEmptyMovieClip("thumbnail_"+i, i); myPic = thumbnail.createEmptyMovieClip("picHolder", 1); myPic.loadMovie(images[i]); thumbnail.angle = angleStep*i; thumbnail.radius = 300; thumbnail.x = Math.cos(thumbnail.angle)*thumbnail.radius; thumbnail.z = Math.sin(thumbnail.angle)*thumbnail.radius; thumbnail.y = 40; thumbnail.display = displayPane; thumbnail.drawBox(_root.thumbnailSize); thumbnail.buttonize(i); thumbnail.notLoaded = true; objectsInScene.push(thumbnail); } panCamera = function () { spin -= this._xmouse/40000; for (var i = 0; i<objectsInScene.length; i++) { objectsInScene[i].display(); } }; thumbnails.onEnterFrame = panCamera; _root.onEnterFrame = function() { for (i=0; i<images.length; i++) { if ((_root.thumbnails["thumbnail_"+i].picHolder.getBytesLoaded()/_root.thumbnails["thumbnail_"+i].picHolder.getBytesTotal() == 1) && _root.thumbnails["thumbnail_"+i].notLoaded) { if (_root.thumbnails["thumbnail_"+i].picHolder._width>=_root.thumbnails["thumbnail_"+i].picHolder._height) { _root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_"+i].picHolder._width-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._width))); _root.thumbnails["thumbnail_"+i].picHolder._y = (_root.thumbnailSize-_root.thumbnails["thumbnail_"+i].picHolder._height)/2; } if (_root.thumbnails["thumbnail_"+i].picHolder._width<=_root.thumbnails["thumbnail_"+i].picHolder._height) { _root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_"+i].picHolder._height-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._height))); _root.thumbnails["thumbnail_"+i].picHolder._x = (_root.thumbnailSize-_root.thumbnails["thumbnail_"+i].picHolder._width)/2; } if (_root.thumbnails["thumbnail_"+i].picHolder._width == _root.thumbnails["thumbnail_"+i].picHolder._height) { _root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_"+i].picHolder._width-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._width))); _root.thumbnails["thumbnail_"+i].picHolder._x = _root.thumbnails["thumbnail_"+i].picHolder._y=0; } _root.thumbnails["thumbnail_"+i].picHolder._alpha = 60; _root.thumbnails["thumbnail_"+i].notLoaded = false; } if ((_root.thumbnails["thumbnail_"+i].picHolder.getBytesLoaded()/_root.thumbnails["thumbnail_"+i].picHolder.getBytesTotal()<1)) { } } if (_root.image.getBytesLoaded()/_root.image.getBytesTotal() == 1) { if (imageLoading == true) { _root.image._alpha = 0; if (_root.image._width>_root.image._height) { _root.image._yscale = _root.image._xscale=(100*(1-(_root.image._width-400)/_root.image._width)); } if (_root.image._height>_root.image._width) { _root.image._yscale = _root.image._xscale=(100*(1-(_root.image._height-400)/_root.image._height)); } if (_root.image._height == _root.image._width) { _root.image._yscale = _root.image._xscale=(100*(1-(_root.image._height-400)/_root.image._height)); } _root.image._x = (725-_root.image._width)/2; _root.image._y = (425-_root.image._height); imageLoading = false; } _root.image._alpha += 5; if (image._alpha>100) { image._alpha = 100; } } };}MovieClip.prototype.buttonize = function(num) { this.onPress = function() { imageLoading = true; _root.image.removeMovieClip(); _root.createEmptyMovieClip("image",3); _root.image.loadMovie(images[num]); }; this.onRollOver = function() { this.picHolder._alpha = 100; }; this.onRollOut = function() { this.picHolder._alpha = 60; };};MovieClip.prototype.drawBox = function(boxSize) { this.lineStyle(1,0x000000,0); this.beginFill(0x000000,100); this.lineTo(boxSize,0); this.lineTo(boxSize,boxSize); this.lineTo(0,boxSize); this.lineTo(0,0); this.endFill();};
全部回答
thumbnail = thumbnails.createEmptyMovieClip("thumbnail_"+i, i); 这句里面的那个+i去掉试试,我也不是太会
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
玩游戏老是要弹出来?
QQ好友想将你删除?在QQ中有些人看了不太顺眼
记分器记分不对是咋回事
DNF这个衣服怎么弄的?一步一步的教我!
QQ邮箱升级后容量
一大二小 打一字
无奈中,!!
互联网策划的职位有前途吗?
急~····!相机高手请进来指点
我们可不可以一直幼稚且快乐下去?
手打里面有什么好看的完结小说么?求几个能TXT
请问江苏6赤道碎星花结值多少钱?
有城市没有房屋,有森林没有树木,有河没有水
有些困惑想在这里罗嗦一下
找几首史上最难听的歌
推荐资讯
2x+1的绝对值和(Y+1)的2次方是相反数
360安全卫士系统清理垃圾文件为什么清理不完
刚装上速达3000XP,请教一下大家,“收缩账套
曾轶可的专辑你会买吗?
减肥最快方法是什么
惠普Conpaq nc6230能不能装Wind7系统
怎么把歌曲下到内存卡?
同一种品牌的台式电脑和笔记本电脑,在相同的
一个人不怕的是什么?
要考试了?如何把状态调整到最好?
怎样查余额啊
100元人民币等于多少丝路英雄点
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?