Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309

    Problemi con caricamento XML

    Ciao Ragà ho un quesito da sottoporvi, ho creato un swf che legge un xml e poi segna i dati in delle text dinamiche, però ho notato che spesso appena carico la pagina o refrescio non riesce a caricare l'xml nei text, devo continuare a refresciare per poi visualizzare i dati, da cosa può dipendere?? Il mio codice:
    codice:
    filexmlA = "layout/partita"+eval("str"+strDataPartite)+".xml?rnd="+random(99999);
    	ApriXMLA();
    
    	function ApriXMLA() {
    	mioxmlA = new XML();
    	mioxmlA.ignoreWhite = true;
    	myarrayA = new Array();
    	mioxmlA.load(filexmlA);
    
    	}
    Questo nel secondo frame, nel primo c'è solo la grafica, e nel terzo ho:
    codice:
    ElaboraXMLT();
    	function ElaboraXMLT(success) {
    	if (mioxmlA.loaded) {
    		strPartita1 = new Array();
    		strPartita2 = new Array();
    ecc.
    Dove sbaglio??
    Ciao By Peter_Pan...

  2. #2
    Forse dico una stupidata ma prova a mettere tutte il codice in un solo frame.....

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    Credo che sia sbagliato, dato che il momento del caricamento e quello della lettura devono essere diversi, cmq proverò, cosa strana è che non mi fa sempre questo errore
    Ciao By Peter_Pan...

  4. #4
    Io lavoro con flash e xml e metto il codice sempre nello stesso frame, tanto fino a quando non viene verificata la condizione mioxml.loaded non gli faccio fare niente...

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    92
    #(crei oggetto)#
    global_xml = new XML();
    global_xml.ignoreWhite = true;

    #(sotto gli dici ke una volta caricato e assicuratosi ke sia stato caricato,cosa dovra fare)#
    global_xml.onLoad = function(success) {
    if (success) {
    processXML();
    }
    };
    global_xml.load('tuo.xml');

    processXML= function(){tua funzione};

    penso ke il tuo problema sia dovuto al fatto di nn aver creato un gestore onLoad, quindi a volte carica i dati in tempi per farteli vedere, altre volte nn fa in tempo.

    ciauz

  6. #6
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    Mi daresti una mano ad integrare il mio codice con il tuo? Io ho fatto così ma mi da errore
    codice:
    global_xml.onLoad = function(success) { 
    if (success) { 
    	processXML(); 
    	} 
    }; 
    
    global_xml.load('tuo.xml'); 
    processXML= function(ElaboraXMLT);
    
    
    ElaboraXMLT();
    	function ElaboraXMLT(success) {
    	if (mioxmlA.loaded) {
    		strPartita1 = new Array();
    		strPartita2 = new Array();
    		strRisultati1 = new Array();
    		strRisultati2 = new Array();
    		myarrayA = mioxmlA.firstChild.childNodes;
    		for (i=0;i<=myarrayA.length;i++){
    			if (myarrayA[i].nodeName == "partitaData"){
    				strY = 32;
    				strDataT = myarrayA[i].attributes.strData;
    				strPartita1[i] = myarrayA[i].childNodes[0].childNodes.toString();
    				strPartita2[i] = myarrayA[i].childNodes[1].childNodes.toString();
    				strRisultati1[i] = myarrayA[i].childNodes[2].childNodes.toString();//Recupero i tel
    				strRisultati2[i] = myarrayA[i].childNodes[3].childNodes.toString();//Recupero i www
    				
    				_root.idxPartite.duplicateMovieClip ("idxP"+i, i);
    				
    				setProperty(_root["idxP"+i], _x, (3,6));
    				
    				setProperty(_root["idxP"+i], _y, (strY+(20*i)));
    				_root["idxP"+i].nomiSquadre1.text = strPartita1[i]+" - "+strPartita2[i];
    				_root["idxP"+i].risultatiSquadre1.text = strRisultati1[i]+" - "+strRisultati2[i];
    				_root.giornata.text = strDataT+"° Giornata";
    				
    				
    				//strProfondita = _root["idxP"+i].getDepth();
    				//prova.text = (strProfondita+1);
    				//FondoClip.swapDepths(10);
    				}
    			}
    			
    	}else {
    		_root.nomiSquadre1.text = "errore";	
    	}
    	} 
    	stop();
    Ciao By Peter_Pan...

  7. #7
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    92
    che errore ti da?
    perchè la costruzione base è semplice,semmai l'errore sta nella funzione,ma ke tipo di erroer è, sintattico?

    ps.

    perchè chiamare processXML() e poi elaboraXMLT, fai un passaggio in piu, chiama direttamente elabora.

  8. #8
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    ecco ho fatto una correzione ma mi da errore di sintassi, manca una perentesi ma dove??
    codice:
    filexmlA = "layout/partita"+eval("str"+strDataPartite)+".xml?rnd="+random(99999);
    	ApriXMLA();
    
    	function ApriXMLA() {
    	mioxmlA = new XML();
    	mioxmlA.ignoreWhite = true;
    	myarrayA = new Array();
    	mioxmlA.load(filexmlA);
    
    	}
    global_xml.onLoad = function(success) { 
    if (success) { 
    	ElaboraXMLT(); 
    	} 
    }; 
    
    global_xml.load(filexmlA); 
    processXML= function(ElaboraXMLT);
    
    
    ElaboraXMLT();
    	function ElaboraXMLT(success) {
    	if (mioxmlA.loaded) {
    		strPartita1 = new Array();
    		strPartita2 = new Array();
    		strRisultati1 = new Array();
    		strRisultati2 = new Array();
    		myarrayA = mioxmlA.firstChild.childNodes;
    		for (i=0;i<=myarrayA.length;i++){
    			if (myarrayA[i].nodeName == "partitaData"){
    				strY = 32;
    				strDataT = myarrayA[i].attributes.strData;
    				strPartita1[i] = myarrayA[i].childNodes[0].childNodes.toString();
    				strPartita2[i] = myarrayA[i].childNodes[1].childNodes.toString();
    				strRisultati1[i] = myarrayA[i].childNodes[2].childNodes.toString();//Recupero i tel
    				strRisultati2[i] = myarrayA[i].childNodes[3].childNodes.toString();//Recupero i www
    				
    				_root.idxPartite.duplicateMovieClip ("idxP"+i, i);
    				
    				setProperty(_root["idxP"+i], _x, (3,6));
    				
    				setProperty(_root["idxP"+i], _y, (strY+(20*i)));
    				_root["idxP"+i].nomiSquadre1.text = strPartita1[i]+" - "+strPartita2[i];
    				_root["idxP"+i].risultatiSquadre1.text = strRisultati1[i]+" - "+strRisultati2[i];
    				_root.giornata.text = strDataT+"° Giornata";
    				
    				
    				//strProfondita = _root["idxP"+i].getDepth();
    				//prova.text = (strProfondita+1);
    				//FondoClip.swapDepths(10);
    				}
    			}
    			
    	}else {
    		_root.nomiSquadre1.text = "errore";	
    	}
    	} 
    	stop();
    Ciao By Peter_Pan...

  9. #9
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    ok funziona ho corretto un po di caz...te che avevo fatto ed è ok
    Ciao By Peter_Pan...

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.