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