begin process at 2012 05 27 18:02:12
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Archive Flash

 > 

Archives

 > 

ActionScript

 > 

Pb de chargement swf externe


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Pb de chargement swf externe

mercredi 20 avril 2005 à 12:42:36 | Pb de chargement swf externe

praganelli

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();

mercredi 20 avril 2005 à 13:40:23 | Re : Pb de chargement swf externe

lalok

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 )

mercredi 20 avril 2005 à 14:12:02 | Re : Pb de chargement swf externe
mercredi 20 avril 2005 à 14:13:38 | Re : Pb de chargement swf externe

praganelli

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.



mercredi 20 avril 2005 à 14:28:03 | Re : Pb de chargement swf externe

praganelli

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();




Cette discussion est classée dans : var, mc, width, lineto, rayon


Répondre à ce message

Sujets en rapport avec ce message

purger une fonction? [ par dak17 ] Bonjour, voila j'ai incorporé une galerie dynamique(en action script)dans une séquence de mon site que j'ai récuperer sur flashkod, mais quand de la g Galerie dynamique XML [ par GillesWebmaster ] Bonjour ,Le code suivant, qui n'est pas de moi, ouvre les Image d'un fichier XML dans le dossier courant et les affiche. Jusque là tout marche bien; s setInterval dans une class [ par webcrea92 ] Bonjour,la classe ci-dessous est rattachée à un clip logo dans le fla. dans la première frame il y'a 2 instances logo1 et logo2.Au lancement les 2 cli Actions bouttons pour activer animation AS3 [ par SASA3475 ] Bonjour à tous et bonne année 2009. Voilà, je suis graphiste et je suis en train de créer mon site entièrement sous flas width sur une variable xml récupérée ne fonctionne pas [ par cd59 ] Bonjour, j'ai un SWF avec des champs de texte. Ces champs sont renseigné dans un xml.Ce qui marche : l'import dans flash des noms des champs de texte probleme de lien d'une image tiré d'un xml [ par scoubydog ] Bonjour, je suis en train de faire une galerie de photos et mon problème est que le code qui me permet de transformer chaque image miniature en bouton Carroussel [ par didine35 ] bonjour, Je suis en train de créer mon site et je suis débutante. J'ai réussi à créer mon index.htm, css.htm et text.js. le carroussel fonction bien m probleme pour attacher deux clip à un clip parent [ par talock ] Bonjour, le problème que je vous pose est le suivant :j'ai créé deux carrés en actionscript, et je veux qu'ils jouent tous les deux le même tween.donc adaptation automatique de la taille de la police [ par szambaux ] Bonjour,tout d'abord je tiens à remerciez tout les membres de se forum qui nous permette de progresser chaque jours.J'ai réalisé une classe de champs


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,796 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales