Pb de chargement swf externe

praganelli Messages postés 6 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 21 avril 2005 - 20 avril 2005 à 12:42
praganelli Messages postés 6 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 21 avril 2005 - 20 avril 2005 à 14:28
Bonjour,

voila j'ai un petit pb avec le script 16971, qui est une galerie photo tout en ActionScript, superbe d'ailleurs..

J'ai un scenario principal dans lequel je charge des pages au niveau2.

J'aimerais en fait pouvoir charger cette galerie photo dans un clip qui
s'appelle "cl_theatre", qui se situe dans un swf qui est lui meme
chargé au niveau 2.



Comment pourrais je faire ?? J'espere que quelqu'un pourras m'aider asser rapidement.



Je joins le script.



_global.SW = Stage.width;

_global.SH = Stage.height;

_global.SWsur2 = SW / 2;

_global.SHsur2 = SH / 2;

Stage.scaleMode = "exactFit";

//----------------------------------------------

MovieClip.prototype.rectangle_arrondi_ombre = function(larg, haut, rayon, epais, couleur, transp) {

var mc = this.createEmptyMovieClip("rectangle_arrondi", 10000);

mc.onLoad = function() {

with (this) {

for (var i = 6; i > 0; i -= .5) {

lineStyle(2 * i, 0x000000, 40 - i * 6);

moveTo(larg + i, rayon * .7 + 5 * i);

lineTo(larg + i, haut - rayon + 2 * i);

curveTo(larg, haut, larg - rayon + 2 * i, haut + i);

lineTo(rayon * .7 + 5 * i, haut + i);

}

moveTo(rayon, 0);

//-------------------

lineStyle(epais, 0x000000, 100);

beginFill(couleur, transp);

moveTo(rayon, 0);

lineTo(larg - rayon, 0);

curveTo(larg, 0, larg, rayon);

lineTo(larg, haut - rayon);

curveTo(larg, haut, larg - rayon, haut);

lineTo(rayon, haut);

curveTo(0, haut, 0, haut - rayon);

lineTo(0, rayon);

curveTo(0, 0, rayon, 0);

endFill();

}

};

mc.onLoad();

};

//----------------------------------------------

_root.createEmptyMovieClip("cadre", -1111);

cadre._x = 2;

cadre._y = 2;

cadre.rectangle_arrondi_ombre(SW - 4, SH - 4, SW / 20, 2, 0x996633, 10);

//----------------------------------------------

MovieClip.prototype.chargement_jpg = function(jpg, couleur, larg, haut) {

var cible = this.dest;

cible._alpha = 0;

cible.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.proportion = (d._width / d._height);

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;

mc._width = mc._w0;

mc._height = mc._h0 * 1.5;

mc.onPress = cliquer;

} else {

var pourcent = (d.getBytesLoaded() / d.getBytesTotal());

mc._width = pourcent * mc._w0;

mc._height = pourcent * mc._h0 * 1.6;

}

}, 100, this);

};

// -----------------------------------------------------

MovieClip.prototype.cliquer = function() {

_global.memoire.swapDepths(0);

_global.memoire.relacher();

if (_global.memoire != this) {

_global.memoire = this;

//---------------------

delete this.onEnterFrame;

//---------------------

var grossissement_V = SH * .9;

var grossissement_H = grossissement_V * this.dest.proportion;

var positiont_V = SHsur2 * 1.1;

//---------------------

this._alpha = 99;

this.swapDepths(_root.niveau++);

//---------------------

var x_deb = this._x;

var y_deb = this._y;

var dis_x = (SWsur2 - x_deb) / 2;

var dis_y = (positiont_V - y_deb) / 2;

var vitesse = Math.PI / 20;

var angle = -Math.PI;

var limite = -Math.PI / 3.3;

var decalage = Math.PI / 6;

//------------------------------------

this.onEnterFrame = function() {

angle += vitesse;

s = 1 + Math.cos(angle - Math.sin(angle - decalage));

this._x = x_deb + s * dis_x;

this._y = y_deb + s * dis_y;

this._width += (grossissement_H - this._width) / 5;

this._height += (grossissement_V - this._height) / 3;

//---------------------

if (angle >= limite) {

this._width = grossissement_H;

this._height = grossissement_V;

delete this.onEnterFrame;

}

};

}

};

// -----------------------------------------------------

MovieClip.prototype.relacher = function() {

delete this.onEnterFrame;

this.onEnterFrame = function() {

this._width += (this._w0 - this._width) / 4;

this._height += (this._h0 - this._height) / 4;

this._x += (this._x0 - this._x) / 4;

this._y += (this._y0 - this._y) / 4;

if (this._yscale < 70) {

this._width = this._w0;

this._height = this._h0 * 1.5;

this._x = this._x0;

this._y = this._y0;

this._alpha = 50;

delete this.onEnterFrame;

}

};

};

// -----------------------------------------------------

MovieClip.prototype.creons = function(tableau) {

var L = SW / (tableau.length + 2);

L = Math.floor(L * .9);

var M = L + 5;

for (var i = 0; i < tableau.length; i++) {

clip = _root.createEmptyMovieClip("cadre" + 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.createEmptyMovieClip("dest", i + 200);

//--------------------

this.dest.onLoad = function() {

this._x = -L - 3;

this._y = -L + 2;

var ladress = tableau[i] + "?" + random(99999);

var ladress = tableau[i];


this._parent.chargement_jpg(ladress, 0xff8800, 20,
50);

};

this.dest.onLoad();

};

clip.onLoad();

}

};

niveau = 10000;

_global.fichier = [];

_global.repertoire = "http://patrice.gobert.free.fr/lesingeblanc/galerie/";

//------------------------------------------------------

fichier[0] = "1.jpg";

fichier[1] = "2.jpg";

fichier[2] = "3.jpg";

fichier[3] = "4.jpg";

fichier[4] = "5.jpg";

fichier[5] = "6.jpg";

//etc... fichier[n] = "n.jpg";

/**/

for (var i = 0; i < fichier.length; i++) {

fichier[i] = repertoire + fichier[i];

}

_root.createEmptyMovieClip("photogalerie", 0);

photogalerie.creons(fichier);

stop();

4 réponses

lalok Messages postés 91 Date d'inscription mardi 24 décembre 2002 Statut Membre Dernière intervention 23 février 2007
20 avril 2005 à 13:40
essaie de remplacer tous les _root par this

( fais attention si les_root sont dans une fonction , il faut trouver le chemin relatif a partir de celle ci )
0
praganelli Messages postés 6 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 21 avril 2005
20 avril 2005 à 14:12
0
praganelli Messages postés 6 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 21 avril 2005
20 avril 2005 à 14:13
J'ai fait ce que tu m'as dit. Je n'ai que le cadre qu i s'affiche, par contre bien dans mon clip.

En ce qui concerne le chemin relatif, peux tu me dire ce que c'est stp ?

Merci beaucoup.
0
praganelli Messages postés 6 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 21 avril 2005
20 avril 2005 à 14:28
Ca y est , c'est presque ok.

Par contre il me reste un petit souci à regler.

En fait quand je clique sur l'image à zoomer, en fait elle passe en dessous les autres vignettes.

Pourrez tu encore m'aider un petit peu stp .

Je te redonne le code modifié:



_global.SW = 650;

_global.SH = 350;

_global.SWsur2 = SW / 2;

_global.SHsur2 = SH / 2;

Stage.scaleMode = "exactFit";

//----------------------------------------------

MovieClip.prototype.rectangle_arrondi_ombre = function(larg, haut, rayon, epais, couleur, transp) {

var mc = this.createEmptyMovieClip("rectangle_arrondi", 10000);

mc.onLoad = function() {

with (this) {

for (var i = 6; i > 0; i -= .5) {

lineStyle(2 * i, 0x000000, 40 - i * 6);

moveTo(larg + i, rayon * .7 + 5 * i);

lineTo(larg + i, haut - rayon + 2 * i);

curveTo(larg, haut, larg - rayon + 2 * i, haut + i);

lineTo(rayon * .7 + 5 * i, haut + i);

}

moveTo(rayon, 0);

//-------------------

lineStyle(epais, 0x000000, 100);

beginFill(couleur, transp);

moveTo(rayon, 0);

lineTo(larg - rayon, 0);

curveTo(larg, 0, larg, rayon);

lineTo(larg, haut - rayon);

curveTo(larg, haut, larg - rayon, haut);

lineTo(rayon, haut);

curveTo(0, haut, 0, haut - rayon);

lineTo(0, rayon);

curveTo(0, 0, rayon, 0);

endFill();

}

};

mc.onLoad();

};

//----------------------------------------------

this.createEmptyMovieClip("cadre", -1111);

cadre._x = 2;

cadre._y = 2;

cadre.rectangle_arrondi_ombre(SW - 4, SH - 4, SW / 20, 2, 0x996633, 10);

//----------------------------------------------

MovieClip.prototype.chargement_jpg = function(jpg, couleur, larg, haut) {

var cible = this.dest;

cible._alpha = 0;

cible.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.proportion = (d._width / d._height);

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;

mc._width = mc._w0;

mc._height = mc._h0 * 1.5;

mc.onPress = cliquer;

} else {

var pourcent = (d.getBytesLoaded() / d.getBytesTotal());

mc._width = pourcent * mc._w0;

mc._height = pourcent * mc._h0 * 1.6;

}

}, 100, this);

};

// -----------------------------------------------------

MovieClip.prototype.cliquer = function() {

_global.memoire.swapDepths(0);

_global.memoire.relacher();

if (_global.memoire != this) {

_global.memoire = this;

//---------------------

delete this.onEnterFrame;

//---------------------

var grossissement_V = SH * .9;

var grossissement_H = grossissement_V * this.dest.proportion;

var positiont_V = SHsur2 * 1.1;

//---------------------

this._alpha = 99;

this.swapDepths(this.niveau++);

//---------------------

var x_deb = this._x;

var y_deb = this._y;

var dis_x = (SWsur2 - x_deb) / 2;

var dis_y = (positiont_V - y_deb) / 2;

var vitesse = Math.PI / 20;

var angle = -Math.PI;

var limite = -Math.PI / 3.3;

var decalage = Math.PI / 6;

//------------------------------------

this.onEnterFrame = function() {

angle += vitesse;

s = 1 + Math.cos(angle - Math.sin(angle - decalage));

this._x = x_deb + s * dis_x;

this._y = y_deb + s * dis_y;

this._width += (grossissement_H - this._width) / 5;

this._height += (grossissement_V - this._height) / 3;

//---------------------

if (angle >= limite) {

this._width = grossissement_H;

this._height = grossissement_V;

delete this.onEnterFrame;

}

};

}

};

// -----------------------------------------------------

MovieClip.prototype.relacher = function() {

delete this.onEnterFrame;

this.onEnterFrame = function() {

this._width += (this._w0 - this._width) / 4;

this._height += (this._h0 - this._height) / 4;

this._x += (this._x0 - this._x) / 4;

this._y += (this._y0 - this._y) / 4;

if (this._yscale < 70) {

this._width = this._w0;

this._height = this._h0 * 1.5;

this._x = this._x0;

this._y = this._y0;

this._alpha = 50;

delete this.onEnterFrame;

}

};

};

// -----------------------------------------------------

MovieClip.prototype.creons = function(tableau) {

var L = SW / (tableau.length + 2);

L = Math.floor(L * .9);

var M = L + 5;

for (var i = 0; i < tableau.length; i++) {

clip = this.createEmptyMovieClip("cadre" + 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.createEmptyMovieClip("dest", i + 200);

//--------------------

this.dest.onLoad = function() {

this._x = -L - 3;

this._y = -L + 2;

var ladress = tableau[i] + "?" + random(99999);

var ladress = tableau[i];


this._parent.chargement_jpg(ladress, 0xff8800, 20,
50);

};

this.dest.onLoad();

};

clip.onLoad();

}

};

niveau = 10000;

_global.fichier = [];

_global.repertoire = "http://patrice.gobert.free.fr/lesingeblanc/galerie/";

//------------------------------------------------------

fichier[0] = "1.jpg";

fichier[1] = "2.jpg";

fichier[2] = "3.jpg";

fichier[3] = "4.jpg";

fichier[4] = "5.jpg";

fichier[5] = "6.jpg";

//etc... fichier[n] = "n.jpg";

/**/

for (var i = 0; i < fichier.length; i++) {

fichier[i] = repertoire + fichier[i];

}

this.createEmptyMovieClip("photogalerie", 0);

photogalerie.creons(fichier);

stop();
0
Rejoignez-nous