non so se è proprio quello che mi serve...
cerco di spiegarmi...
sto cercando di adattare "GALLERIA INTERRATIVA 1.01" (che ho preso nella sezione movie).
la porzione di codice originale è:
...
Codice PHP:
_global.file = [];
file[0] = "1.jpg";
file[1] = "2.jpg";
file[2] = "3.jpg";
file[3] = "4.jpg";
file[4] = "5.jpg";
file[5] = "6.jpg";
file[6] = "7.jpg";
file[7] = "8.jpg";
for (var i = 0; i < file.length; i++) {
file[i] = percorso_web + file[i];
//trace(file[i]);
}
vorrei capire come fare per prelevare questa lista da un file esterno...
spero di essermi spiegato...
grazie cmq per l'aiuto
ps... qui per completezza inserisco l'intero codice...
Codice PHP:
//---------------------------------------------------------------------------------------------------------
// GALLERIA INTERRATIVA 1.01
// by [url]www.contidavide.it[/url]
// [email]daw_conti@libero.it[/email]
//---------------------------------------------------------------------------------------------------------
//Dimensioni dello stage
_global.SW = Stage.width;
_global.SH = Stage.height;
_global.SWsur2 = SW / 2;
_global.SHsur2 = SH / 2;
// misura esatta
Stage.scaleMode = "exactFit";
MovieClip.prototype.caricamento_jpg = function(jpg, colore) {
var foto = this.dest;
foto._alpha = 0;
foto.loadMovie(jpg);
var id = setInterval(function (mc) {
var d = mc["dest"];
if (d._width > 0) {
clearInterval(id);
d.memw = d._width;
d.memh = d._height;
d.proporzione = (d._width / d._height);
// dimensione foto thumbs
d._width = Math.floor(mc._w0 * 2);
d._height = Math.floor(mc._h0 * 2);
d._alpha = 99;
with (d) {
lineStyle(4, 0x444444, 80);
moveTo(this._x + memw + 1, this._y - 1);
lineTo(this._x + memw + 1, this._y + memh + 1);
lineTo(this._x - 1, this._y + memh + 1);
lineStyle(4, 0xaaaaaa, 80);
lineTo(this._x - 1, this._y - 1);
lineTo(this._x + memw + 1, this._y - 1);
}
// --------------------
mc._alpha = 99;
// FOTO THUMBS CHE ASSUME LA STESSA FORMA DELLA FOTO ORIGINALE
// Se desiderate che le foto thumbs abbiano le stesse dimensioni
// tra di loro mettete 2 barre slash (che servono per commentare)
// a questa riga qui sotto
mc._w0 *= d.proporzione;
mc._width = mc._w0;
mc._height = mc._h0;
mc.onPress = clicca;
mc.onRelease = rilascio;
mc.onReleaseOutside = rilascio;
} else {
// caricamento mc
var percentuale = (d.getBytesLoaded() / d.getBytesTotal());
mc._width = percentuale * mc._w0;
mc._height = percentuale * mc._h0 * 1.6;
}
}, 100, this);
};
// --------------------------------------------------------
// FUNZIONE QUANDO PREMIAMO LA FOTO PICCOLA SI INGRANDISCE
// --------------------------------------------------------
MovieClip.prototype.clicca = function() {
// FUNZIONE THUMBS
// Stage width (SW) 550 px
// Stage height (SH) 400 px
// Dimensioni foto usata nell'esempio
// Lunghezza 275 px, altezza 200 px
// SH = 400 * 0.50 = 200 px
// proporzione tra lunghezza/altezza = 275/200 = 1,375 (275px e 200px sono le dimensioni di una foto)
// se la lunghezza_H (330px) è maggiore di SW (550px*0,6)
// 0.50 è il valore per rimpicciolire le dimensioni verticali della foto
// se la foto misura verticalmente 400 pixel e li moltiplichiamo * 0.50 diventa di 200 pixel
// come se la facessimo a metà
var lunghezza_V = SH //* .50;
// mentre le dimensioni orizzontali sono date dal prodotto tra la lunghezza verticale e la
// proporzione tra lunghezza e altezza della foto
var lunghezza_H = lunghezza_V * this.dest.proporzione;
// se la lunghezza_H è maggiore dello stage._width (SW) moltiplicata per 0.6 allora
// dobbiamo ridimensionare la foto per evitare che fuoriesca dallo stage
if (lunghezza_H > SW * .6) {
delta = lunghezza_H / SW * .6;
lunghezza_V *= delta;
lunghezza_H *= delta;
// valori ottimali per vedere le foto corrette si orizzontalmente e verticalmente
/*
var lunghezza_V = SH * .50;
var lunghezza_H = lunghezza_V * this.dest.proporzione;
if (lunghezza_H > SW * .6) {
delta = lunghezza_H / SW * .6;
lunghezza_V *= delta;
lunghezza_H *= delta;
*/
}
//---------------------
delete this.onEnterFrame;
//---------------------
this._x0 = _root._xmouse - this._x;
this._y0 = _root._ymouse - this._y;
this.swapDepths(_root.livello += 20);
this.onEnterFrame = function() {
this._x = _root._xmouse - this._x0;
this._y = _root._ymouse - this._y0;
this._ww = this._width / 2;
this._hh = this._height / 2;
if ((this._x - this._ww) < 0) {
this._x = this._ww;
}
if ((this._y - this._hh) < 0) {
this._y = this._hh;
}
if ((this._x + this._ww) > SW) {
this._x = SW - this._ww;
}
if ((this._y + this._hh) > SH) {
this._y = SH - this._hh;
}
this._rotation += (0 - this._rotation) / 3;
this._width += (lunghezza_H - this._width) / 3;
this._height += (lunghezza_V - this._height) / 3;
};
};
// --------------------------------------------------------
// FUNZIONE RILASCIO FOTO CON IL MOUSE
// --------------------------------------------------------
MovieClip.prototype.rilascio = function() {
delete this.onEnterFrame;
this._x = (_root._xmouse < 50) ? 50 : (_root._xmouse > SW - 50) ? SW - 50 : _root._xmouse;
this._y = (_root._ymouse < 50) ? 50 : (_root._ymouse > SH - 50) ? SH - 50 : _root._ymouse;
this.onEnterFrame = function() {
this._rotation += (this._r - this._rotation) / 2;
this._width += (this._w0 - this._width) / 4;
this._height += (this._h0 - this._height) / 4;
if (Math.abs(this._w0 - this._width) < 10) {
this._rotation = this._r;
this._width = this._w0;
this._height = this._h0;
delete this.onEnterFrame;
}
};
};
// -----------------------------------------------------
MovieClip.prototype.crea_y = function(tabella) {
var L = SW / (tabella.length + 2) * 2.5;
var L = SW / 7;
L = Math.floor(L * .9);
var M = L + 5;
for (var i = 0; i < tabella.length; i++) {
clip = _root.createEmptyMovieClip("thumbs" + i, i);
clip.onLoad = function() {
//--------------------
this._alpha = 30;
this.lineStyle(4, 0, 20);
this.moveTo(-(L + 2), L);
this.lineTo(M, L);
this.lineTo(M, -(L - 3));
// --------------------
this.moveTo(M, -L);
this.lineStyle(0, 0x999999);
this.beginFill(0xfff6f0, 100);
this.lineTo(-M, -L);
this.lineTo(-M, L);
this.lineStyle(0, 0);
this.lineTo(M, L);
this.lineTo(M, -L);
this.endFill();
//--------------------
this._x0 = (1.2 * (i + 1)) * L;
this._y0 = L;
this._x = this._x0;
this._y = this._y0;
//--------------------
this._w0 = L + 3;
this._h0 = L - 5 + 3;
this._width = this._w0;
this._height = this._h0;
//--------------------
this._x = (SW * .15) + random(SW * .7);
this._y = (SH * .15) + random(SH * .7);
this._r = -30 + 60 * Math.random();
this._rotation = this._r;
//--------------------
this.createEmptyMovieClip("dest", i + 200);
//--------------------
this.dest.onLoad = function() {
this._x = -L - 3;
this._y = -L + 2;
// randomizza la posizione della foto nello stage
var posizione = tabella[i] + "?" + random(99999);
var posizione = tabella[i];
this._parent.caricamento_jpg(posizione, 0x33FFFF);
};
this.dest.onLoad();
};
clip.onLoad();
}
};
//------------------------------------------------------
livello = 10000;
//------------------------------------------------------
_global.file = [];
// --------------------------------------------------------
// IMMAGINI CARICATE DA INTERNET
// --------------------------------------------------------
/*
file[0] = "http://images.motograndprix.com/multimedia2/280/280791.jpg";
file[1] = "http://images.motograndprix.com/multimedia2/280/280783.jpg";
file[2] = "http://images.motograndprix.com/multimedia2/280/280808.jpg";
file[3] = "http://images.motograndprix.com/multimedia2/280/280786.jpg";
file[4] = "http://images.motograndprix.com/multimedia2/280/280800.jpg";
*/
// --------------------------------------------------------
// IMMAGINI CARICATE IN LOCALE
// I file jpg sono nella stessa cartella del file swf.
// Se volete mettere le immagini dentro una cartella chiamata immagini
// il percorso sarà:
// file[0] = "immagini/1.jpg";
// file[1] = "immagini/2.jpg";
// --------------------------------------------------------
file[0] = "1.jpg";
file[1] = "2.jpg";
file[2] = "3.jpg";
file[3] = "4.jpg";
file[4] = "5.jpg";
file[5] = "6.jpg";
file[6] = "7.jpg";
file[7] = "8.jpg";
for (var i = 0; i < file.length; i++) {
file[i] = percorso_web + file[i];
//trace(file[i]);
}
_root.createEmptyMovieClip("galleria", 0);
galleria.onLoad = function() {
this.crea_y(file);
};
galleria.onLoad();
//------------------------------------------------------
stop();