Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    caricare tutte le varibili...

    ho un problemino... un po' urgente... dovrei caricare tutte le varibile prese da un file txt al momento io le carico così:

    codice:
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success)
    {
        if(success){
            this.path.news_0 = this.news_0;
    		this.path.news_1 = this.news_1;
    		this.path.news_2 = this.news_2;
    		this.path.news_3 = this.news_3;
    		this.path.news_4 = this.news_4;
    		this.path.news_5 = this.news_5;
    		gotoAndPlay(3);
        } else {
            trace("Variabili non caricate");
        }
    };
    dati.load("news.txt");
    so che è possbibile ma non trovo più il link...

  2. #2

  3. #3
    niente volevo sapere quale script si usa per caricare tutte le varibili prese dal file txt cioè senza fare:

    this.path.news_1 = this.news_1;
    this.path.news_2 = this.news_2;
    this.path.news_3 = this.news_3;
    this.path.news_4 = this.news_4;
    this.path.news_5 = this.news_5;


    fare il comando carica tutte le varibili...
    non so se sono stato chiaro...

  4. #4
    quello è il procedimento giusto, se poi le variabili sono consecutive (come nell'esempio) potresti fare un ciclo.

  5. #5
    mi potresti aiutare ho fatto così... ma c'è qualcosa che mi sfugge:

    codice:
    stop();
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success)
    {
        if(success){
    		this.path.numero_news = this.numero_news;
    		var i2:Number = numero_news
    	while (i2>=0) {
            this.path.["news_" + i2] = this.["news_" + i2];
    		--i2
    	}
    		gotoAndPlay(2);
        } else {
            trace("Variabili non caricate");
        }
    };
    dati.load("news.txt");
    tutte le varibili si chiamo con nome + numero che va a scalare quindi news_0 news_1 ecc... :master:

  6. #6
    stop();
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success) {
    if(success){
    for (i=1; i<4; i++) {
    this.path["news_"+i] = this["news_"+i];
    }

    } else {
    trace("Variabili non caricate");
    }
    };
    dati.load("news.txt");


    prova!!!!

  7. #7
    scusami ancora ..tu hai messo 4 ma io non so quante sono le varibili il numero delle varibili perchè le mi vengono restituite da una pagina asp ...

  8. #8
    in qualche modo devi farlo sapere a flash se no non può sapere quante volte ciclare.
    Fagli creare e poi caricare un txt a parte, o metti quest'informazione nello stesso txt delle variabili.

  9. #9
    si infatti ora non posso provare ma va bene così:

    stop();
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success) {
    if(success){
    this.path.numero_news = this.numero_news;
    var i:Number = numero_news
    for (i=0; i<numero_news; i++) {
    this.path["news_"+i] = this["news_"+i];
    }

    } else {
    trace("Variabili non caricate");
    }
    };
    dati.load("news.txt");


  10. #10
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    forse era una roba del genere
    codice:
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success){
        if(success){
    	for(name in this){
    		this.path[name] = this[name];
    	}
    	gotoAndPlay(3);
        } else {
            trace("Variabili non caricate");
        }
    };
    dati.load("news.txt");

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.