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

Flash / Flash MX

 > 

Scripts

 > 

ActionScript

 > 

Galerie dynamique XML


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

Galerie dynamique XML

jeudi 10 juillet 2008 à 12:25:44 | Galerie dynamique XML

GillesWebmaster

Membre Club


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; seulement mes images, une fois agrandies et rétrécies (après deux clics), ne se rouvrent plus vers le bon endroit; au lieu de venir au centre de l'écran, elles se décalent: comment réparer cela?


xmlDoc= new XML();
xmlDoc.ignoreWhite=true;
xmlDoc.load("xml.xml");
xmlDoc.onLoad = Operations;
function Operations(success)
    {
        if (success)
            {
                _global.SW = 550;
                _global.SH = 400;
                _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,Grandjpg, couleur) {
                _global.GrandeImageURL;
                GrandeImageURL=Grandjpg;
                    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 = 125;//TAILLE DE LA PTITE IMAGE
                            mc._height = 86;//TAILLE DE LA PTITE IMAGE
                            mc.onPress = function()
                                {
                                   
                                    d.loadMovie(GrandeImageURL, d);
                                    d.memw = mc._width;
                                    d.memh = mc._height;
                                    d.proportion = (d._width / d._height);
                                    d._width = Math.floor(mc._w0 * 2);
                                    d._height = Math.floor(mc._h0 * 2);
                                    d._alpha = 99;
                           
                           
                                    _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*1.18;
                                        var positiont_V = 105;
                                        var positiont_H = 110;
                                        //---------------------
                                        this._alpha = 99;
                                        this.swapDepths(_root.niveau++);
                                        //---------------------
                                        var x_deb = this._x;
                                        var y_deb = this._y;
                                        var dis_x = (positiont_H - 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.4;
                                        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-5;
                                            this._y = y_deb + s * dis_y-6;
                                            this._width += (grossissement_H - this._width) / 5.5;
                                            this._height += (grossissement_V - this._height) / 2.9;
                                            //---------------------
                                            if (angle >= limite) {
                                                this._width = 125*4;
                                                this._height = 86*4;
                                                delete this.onEnterFrame;
                                            }
                                        };
                                    }
                                };
                        } else {
                            var pourcent = (d.getBytesLoaded() / d.getBytesTotal());
                            mc._width = pourcent * mc._w0;
                            mc._height = pourcent * mc._h0 * 1.6;
                        }
                    }, 100, this);
                };
                // -----------------------------------------------------
                //MovieClip.prototype.cliquer
                // -----------------------------------------------------
                MovieClip.prototype.relacher = function() {
                    delete this.onEnterFrame;
                    this.swapDepths(_root.niveau++);
                            this._alpha = 80;
                    this.onEnterFrame = function() {
                        this._width += (this._w0 - this._width) / 10;
                        this._height += (this._h0 - this._height) / 10;
                        this._x += (this._x0 - this._x) / 2;
                        this._y += (this._y0 - this._y) / 2;
                        if (this._yscale < 200) {// TAILLE
                            this._width = 125;//TAILLE DE LA PTITE IMAGE
                            this._height = 86;//TAILLE DE LA PTITE IMAGE
                            this._x = this._x0;
                            this._y = this._y0;
                            this._alpha = 80;
                            delete this.onEnterFrame;
                        }
                    };
                };
                // -----------------------------------------------------
                MovieClip.prototype.creons = function(tableau,grandtableau) {
                    var L = SW / (tableau.length + 2);
                    L = Math.floor(L * .9);
                    var M = L + 5;
                    var j = 0;
                    var k = 0;
                    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 ), L);
                        //    this.lineTo(M, L);
                        //    this.lineTo(M, -(L ));
                            // --------------------
                            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();
                            //--------------------
                           
                            if((i%4)==0) { k=0; j=j+1.5;}
                            this._x0 = ((4.6 * (k )) * L)+85;
                        //    trace(k);
                        //    trace("J:"+j);
                            this._y0 = j*L*2.1;
                            this._y = this._y0;
                            this._x = this._x0;
                            //--------------------
                            this._w0 = L + 3;
                            this._h0 = L - 5 + 3;
                            this._width = 125;
                            this._height = 86;
                            //--------------------
                            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];
                                var ladressBIG = grandtableau[i];
                            //trace("BIG IMG:"+ladressBIG);
                                this._parent.chargement_jpg(ladress,ladressBIG, 0xff8800);
                            };
                            this.dest.onLoad();
                        };
                        clip.onLoad();
                        k++;
                    }
                };
                niveau = 10000;
                _global.fichier = [];
                _global.Grandfichier = [];
                _global.repertoire ="";// "img/";
                nombredimages= xmlDoc.firstChild.firstChild.childNodes.length;
                            for (numero=0; numero<nombredimages; numero++)
                                {
                                    fichier[numero]=xmlDoc.firstChild.firstChild.firstChild.attributes.SmallImg;
                                    Grandfichier[numero]=xmlDoc.firstChild.firstChild.firstChild.attributes.BigImg;
                                //    trace(fichier[numero] +"  -  "+ fichier[numero]);
                                }
                _root.createEmptyMovieClip("photogalerie", 0);
                photogalerie.creons(fichier,Grandfichier);
                stop();
               
            }
    };


Merci d'avance...
GillesWebmaster





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


Répondre à ce message

Sujets en rapport avec ce message

Pb de chargement swf externe [ par 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 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 Limite de page trop courte [ par karolyn74 ] BonjourJ'ai un soucis qui je pense est minime mais je n'arrive pas à trouver quel chiffre et où il faut le modifiez et si il faut mettre plus grand ou 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 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 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 problème d'amélioration de polaroid galery [ par lirisnocif ] Bonjour je souhaite utiliser cette galerie :http://www.no3dfx.com/polaroid/après avoir effectué plusieurs modifications pour remanier le script à ma f 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


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,702 sec (3)

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