Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Problema con XML

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2001
    residenza
    Napoli, Italia
    Messaggi
    1,074

    Problema con XML

    Ho una gallery, che carica le immagini da un file XML.
    Questo è il codice che ho sulla timeline di un mc:
    Codice PHP:
    stop();
    this.mp._alpha 0;
    var 
    numFadeRate 5;
    function 
    imgSlide() {
        
    onEnterFrame = function () {
            
    this.mp._alpha -= numFadeRate;
            if (
    this.mp._alpha<0) {
                
    delete onEnterFrame;
                
    this.mp.unloadMovie();
                
    showRecord(loadNumber);
            }
        };
    }
    function 
    show() {
        
    onEnterFrame = function () {
            
    this.mp._alpha += numFadeRate;
            if (
    this.mp._alpha>100) {
                
    delete onEnterFrame;
            }
        };
    }
    this.currentRecord 0;
    function 
    dataLoaded(complete) {
        if (
    complete) {
            
    this.nodeCount xmlObject.firstChild.childNodes.length;
            
    showRecord(1);
        }
    }
    xmlObject = new XML();
    xmlObject.ignoreWhite true;
    xmlObject.onLoad dataLoaded;
    xmlObject.load("marketplace.xml");
    function 
    showNext() {
        if (
    this.currentRecord == this.nodeCount) {
            
    loadNumber 1;
        } else {
            
    loadNumber this.currentRecord+1;
        }
        
    imgSlide();
    }
    function 
    showPrevious() {
        if (
    this.currentRecord == 1) {
            
    loadNumber this.nodeCount;
        } else {
            
    loadNumber this.currentRecord-1;
        }
        
    imgSlide();
    }
    function 
    showRecord(recordNumber) {
        var 
    nodeObject xmlObject.firstChild.childNodes[recordNumber-1];
        
    media nodeObject.attributes.media;
        
    slideFilename media+".jpg";
        
    this.mp.loadMovie(slideFilename);
        
    onEnterFrame = function () {
            
    bytesLoaded this.mp.getBytesLoaded();
            if (
    bytesLoaded == this.mp.getBytesTotal()) {
                
    delete onEnterFrame;
                
    show();
            }
        };
        
    this.currentRecord recordNumber;

    Il file XML caricato ha una struttura del tipo:
    Codice PHP:
    <?xml version="1.0"?>
    <mySlideShow>
    <myImage media = "market01">
    </myImage>
    <myImage media = "market02">
    </myImage>
    <myImage media = "market03">
    </myImage>
    ...
    </mySlideShow>
    Il problema è che, cliccando i pulsanti per muoversi avanti / indietro - rispettivamente, con l'A.S. di seguito riportato:
    Codice PHP:
    on (release) {
        
    _root.showNext();

    Codice PHP:
    on (release) {
        
    _root.showPrevious();

    la gallery non scorre. La prima immagine viene regolarmente caricata, ma poi non accade nulla. In effetti, mi sembra che il problema consiste nel fatto che la stringa:
    Codice PHP:
    this.nodeCount xmlObject.firstChild.childNodes.length
    sembra non funzionare. Cioè, il texfield nodeCount non carica alcun valore, quindi - evidentemente - non registra il numero totale di nodi del file XML.
    Perchè?
    Mi sto rimbecillendo, ma non riesco a vedere l'errore...
    Please, help...
    metatad
    graphic & web design

  2. #2
    Utente di HTML.it
    Registrato dal
    Sep 2001
    residenza
    Napoli, Italia
    Messaggi
    1,074
    ok, risolto...
    metatad
    graphic & web design

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.