Imagen del problema
Código PHP:
picData = new XML();
picData.ignoreWhite = true;
picData.onLoad = loadXML;
picData.load("imagenes.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);
}
//posicion imagenes pequeñas
thumbnails._x = 440;
thumbnails._y = 390;
imageLoading = true;
numObjects = images.length;
objectsInScene = new Array();
focalLength = 800;
spin = 0;
_root.thumbnailSize = 125/((numObjects)/9);
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 = 250;//espacio entre fotos
thumbnail.x = Math.cos(thumbnail.angle)*thumbnail.radius;
thumbnail.z = Math.sin(thumbnail.angle)*thumbnail.radius;
thumbnail.y = 30;//altura de fotos
thumbnail.display = displayPane;
thumbnail.drawBox(_root.thumbnailSize);
thumbnail.buttonize(i);
thumbnail.notLoaded = true;
objectsInScene.push(thumbnail);
}
panCamera = function () {
spin -= this._xmouse/10000;//velocidad del mouse
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)) {
}
}
//dimensiones de foto grande
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));
}
//posicion foto grande
_root.image._x = (890-_root.image._width)/2;//foto grande scala
_root.image._y = (420-_root.image._height);//foto grande scala
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 = 100;
};
};
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();
};