Visualizzazione dei risultati da 1 a 6 su 6

Discussione: [MX] Galleria con XML

  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    5

    [MX] Galleria con XML

    Ciao ragazzi,
    stavo cercando di creare una galleria di immagini le quali venivano richiamate dal file XML quando l'utente clicca sui pulsanti. Qui potete vedere l'esercizio http://www.webalice.it/romano.mauro.
    Il primo problema sta nel triangolino in basso, quando clicco dovrebbe caricare la 2 immagine invece devo cliccare più volte prima che venga caricata. Questo difetto succede se comincio a cliccare subito il triangolo e non i pulsanti.

    Il secondo problema è il fatto che se aumentano le foto ogni volta devo aprire il Fla e questo volevo evitarlo se era possibile? L'altro problema è se ne ho 80 di foto come faccio a farle scrollare?

    if (i<7) {
    q._x = i*50+45;
    q._y = 45+80;
    } else if (i<14) {
    q._x = i*50-305;
    q._y = 45+130;
    }
    Il terzo problema è quello di rendere disattivato il pulsante premuto,ma quando premo un altro pulsante l'altro deve diventare di un altro colore ma cliccabile.

    Sotto c'è il file XML e ActionScript.

    Questo è il file XML:
    <?xml version="1.0"?>
    <galleria>
    <img nome="01" pos="foto/img0.jpg"></img>
    <img nome="02" pos="foto/img1.jpg"></img>
    <img nome="03" pos="foto/img2.jpg"></img>
    <img nome="04" pos="foto/img3.jpg"></img>
    <img nome="05" pos="foto/img4.jpg"></img>
    <img nome="06" pos="foto/img5.jpg"></img>
    <img nome="07" pos="foto/img6.jpg"></img>
    <img nome="08" pos="foto/img7.jpg"></img>
    <img nome="09" pos="foto/img8.jpg"></img>
    <img nome="10" pos="foto/img9.jpg"></img>
    <img nome="11" pos="foto/img10.jpg"></img>
    <img nome="12" pos="foto/img11.jpg"></img>
    <img nome="13" pos="foto/img12.jpg"></img>
    <img nome="14" pos="foto/img13.jpg"></img>
    </galleria>
    Questo è il codice:

    // è il pulsante indietro che parte invisibile
    prev_btn._visible = 0;
    // Mi creo l'oggetto XML
    var fotos:XML = new XML();
    fotos.ignoreWhite = true;
    fotos.load("galleria.xml");
    fotos.onLoad = function(success) {
    if (success) {
    // Carica la prima foto all'interno del MC foto_mc
    loadMovie(fotos.firstChild.childNodes[0].attributes.pos, _root.foto_mc);
    // All'interno del campo dinamico foto_txt viene messo il valore dell'attributo.
    _root.foto_txt.text = fotos.firstChild.childNodes[0].attributes.nome;
    // Faccio il loading del MC foto_mc nel quale vengono caricate le immagini
    _root.onEnterFrame = function() {
    car = foto_mc.getBytesLoaded();
    tot = foto_mc.getBytesTotal();
    if (car<tot) {
    carica._visible = true;
    carica.carica_bar._xscale = Math.round((car/tot)*100);
    } else {
    carica._visible = false;
    if (foto_mc._alpha<100) {
    foto_mc._alpha += 3;
    // Questo dovrebbe disabilitare onEnterFrame
    // Ma se lo metto non mi parte il loading
    this.onEnterFrame = undefined;
    }
    }
    };
    for (var i = 0; i<fotos.firstChild.childNodes.length; i++) {
    q = _root.rett_mc.duplicateMovieClip("img"+i, i);
    q.numeri_txt.text = fotos.firstChild.childNodes[i].attributes.nome;
    // Questi sono i pulsanti.
    // Volevo evitare ogni volta di aprire il Fla
    // volevo modificare il tutto all'interno del file XML
    if (i<7) {
    q._x = i*50+45;
    q._y = 45+80;
    } else if (i<14) {
    q._x = i*50-305;
    q._y = 45+130;
    }
    //trace(fotos.firstChild.childNodes[i].attributes.nome);
    q.onRollOver = function() {
    this.numeri_txt.textColor = "0xFFFFFF";
    };
    q.onRollOut = function() {
    this.numeri_txt.textColor = "0x000000";
    };
    q.onRelease = q.onReleaseOutside=q.onDragOut=function () {
    this.numeri_txt.textColor = "0x000000";
    f = this._name.substr(3);
    i = f;
    // trace(f);
    loadMovie(fotos.firstChild.childNodes[i].attributes.pos, _root.foto_mc);
    _root.foto_txt.text = fotos.firstChild.childNodes[i].attributes.nome;
    // trace(fotos.firstChild.childNodes[i].attributes.pos);
    };
    // Questo è il pulsante freccia che manda avanti le foto
    next_btn.onRelease = function() {
    i++;
    if (i<fotos.firstChild.childNodes.length) {
    loadMovie(fotos.firstChild.childNodes[i].attributes.pos, _root.foto_mc);
    foto_txt.text = fotos.firstChild.childNodes[i].attributes.nome;
    //trace(fotos.firstChild.childNodes[i].attributes.pos);
    if (i>=1) {
    prev_btn._visible = 1;
    }
    if (i>=fotos.firstChild.childNodes.length-1) {
    this._visible = 0;
    }
    } else {
    i<=fotos.firstChild.childNodes.length;
    i = 0;
    }
    };
    // Questo è il pulsante freccia che manda indietro le foto
    prev_btn.onRelease = function() {
    i--;
    if (i<fotos.firstChild.childNodes.length) {
    loadMovie(fotos.firstChild.childNodes[i].attributes.pos, _root.foto_mc);
    foto_txt.text = fotos.firstChild.childNodes[i].attributes.nome;
    //trace(fotos.firstChild.childNodes[i].attributes.pos);
    if (i<=0) {
    this._visible = 0;
    }
    }
    if (i>=foto.firstChild.childNodes.length-2) {
    next_btn._visible = 1;
    }
    };
    }
    } else {
    //trace("error");
    }
    };



  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Troppo codice..

    Cosa è associato al pulsante triangolare?

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    5
    Questo è il link http://www.webalice.it/romano.mauro/home.htm
    al pulsante ho associato:


    // Questo è il pulsante freccia che manda avanti le foto
    next_btn.onRelease = function() {
    i++;
    if (i<fotos.firstChild.childNodes.length) {
    loadMovie(fotos.firstChild.childNodes[i].attributes.pos, _root.foto_mc);
    foto_txt.text = fotos.firstChild.childNodes[i].attributes.nome;
    //trace(fotos.firstChild.childNodes[i].attributes.pos);
    if (i>=1) {
    prev_btn._visible = 1;
    }
    if (i>=fotos.firstChild.childNodes.length-1) {
    this._visible = 0;
    }
    } else {
    i<=fotos.firstChild.childNodes.length;
    i = 0;
    }
    };
    // Questo è il pulsante freccia che manda indietro le foto
    prev_btn.onRelease = function() {
    i--;
    if (i<fotos.firstChild.childNodes.length) {
    loadMovie(fotos.firstChild.childNodes[i].attributes.pos, _root.foto_mc);
    foto_txt.text = fotos.firstChild.childNodes[i].attributes.nome;
    //trace(fotos.firstChild.childNodes[i].attributes.pos);
    if (i<=0) {
    this._visible = 0;
    }
    }
    if (i>=foto.firstChild.childNodes.length-2) {
    next_btn._visible = 1;
    }
    };
    }

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    5
    up

  5. #5
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    5
    up

  6. #6
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    5
    up

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.