Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Problema strano

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    2,929

    Problema strano

    ciao a tutti,
    Nega scusa per il titolo ma non sapevo che mettere

    allora non capisco perchè cosi và
    codice:
    search.onRelease = function() {
        trace(_global.pathfile);
        trace(_global.cercapath);
        myDfor = new LoadVars();
        myDfor.cercaP = cercaP.text;
        myDfor.onLoad = function(success) {
            trace(this.totale);
            var totale:Number = Number;
            var myArrayP:Array = new Array();
            for (i=1; i<=this.totale; i++) {
                myArrayP[i] = new Object();
                myArrayP[i]["nIDProdotto"] = _root.myDfor["IDProdotto"+i];
                myArrayP[i]["nProdotto"] = _root.myDfor["Prodotto"+i];
                myArrayP[i]["nDescrizione"] = _root.myDfor["Descrizione"+i];
                myArrayP[i]["nIDFornitore"] = _root.myDfor["IDFornitore"+i];
                myArrayP[i]["nquantit"] = _root.myDfor["quantit"+i];
                myArrayP[i]["nPrezzo"] = _root.myDfor["Prezzo"+i];
                myArrayP[i]["nCategoria"] = _root.myDfor["Categoria"+i];
                myArrayP[i]["ndataodiernap"] = _root.myDfor["dataodiernap"+i];
                myArrayP[i]["ncapacita"] = _root.myDfor["capacita"+i];
                myArrayP[i]["nmarca"] = _root.myDfor["marca"+i];
                myArrayP[i]["ncodProdotto"] = _root.myDfor["codProdotto"+i];
                myArrayP[i]["ngestore"] = _root.myDfor["gestore"+i];
            }
        };
        trace(_global.cercapath);
        myDfor.sendAndLoad(_global.cercapath, myDfor, "GET");
    };
    stop();
    se inserisco un semplica controllo non và più o meglio nel trace mi dà undefined

    codice:
    search.onRelease = function() {
        trace(_global.pathfile);
        trace(_global.cercapath);
        myDfor = new LoadVars();
        myDfor.cercaP = cercaP.text;
        myDfor.onLoad = function(success) {
            trace(this.totale);
            var totale:Number = Number;
            if (this.totale == 0) {
                Alert.show("Non ci sono prodotti", "ATTENZIONE!!", Alert.OK, _parent, null, "alert_ico");
            } else if (this.totale>0) {
                var myArrayP:Array = new Array();
                for (i=1; i<=this.totale; i++) {
                    myArrayP[i] = new Object();
                    myArrayP[i]["nIDProdotto"] = _root.myDfor["IDProdotto"+i];
                    myArrayP[i]["nProdotto"] = _root.myDfor["Prodotto"+i];
                    myArrayP[i]["nDescrizione"] = _root.myDfor["Descrizione"+i];
                    myArrayP[i]["nIDFornitore"] = _root.myDfor["IDFornitore"+i];
                    myArrayP[i]["nquantit"] = _root.myDfor["quantit"+i];
                    myArrayP[i]["nPrezzo"] = _root.myDfor["Prezzo"+i];
                    myArrayP[i]["nCategoria"] = _root.myDfor["Categoria"+i];
                    myArrayP[i]["ndataodiernap"] = _root.myDfor["dataodiernap"+i];
                    myArrayP[i]["ncapacita"] = _root.myDfor["capacita"+i];
                    myArrayP[i]["nmarca"] = _root.myDfor["marca"+i];
                    myArrayP[i]["ncodProdotto"] = _root.myDfor["codProdotto"+i];
                    myArrayP[i]["ngestore"] = _root.myDfor["gestore"+i];
                }
            }
            trace(_global.cercapath);
            myDfor.sendAndLoad(_global.cercapath, myDfor, "GET");
        };
    };
    stop();
    le variabili _global nel secondo caso rimangono vuote

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Non ho capito. Nel primo caso:

    codice:
    trace(_global.cercapath); 
    myDfor.sendAndLoad(_global.cercapath, myDfor, "GET");
    funziona e nel secondo no?

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    2,929
    si nel primo funziona!!!

  4. #4
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Nel secondo hai messo il sendAndLoad dentro il l'onLoad...

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    2,929
    non capisco?!? :master:

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    2,929
    ok ma se metto cosi le var globali non le vede

    codice:
    search.onRelease = function() {
        trace(_global.pathfile);
        trace(_global.cercapath);
        myDfor = new LoadVars();
        myDfor.cercaP = cercaP.text;
        myDfor.onLoad = function(success) {
            trace(this.totale);
            var totale:Number = Number;
            if (this.totale == 0) {
                Alert.show("Non ci sono prodotti", "ATTENZIONE!!", Alert.OK, _parent, null, "alert_ico");
            } else if (this.totale>0) {
                var myArrayP:Array = new Array();
                for (i=1; i<=this.totale; i++) {
                    myArrayP[i] = new Object();
                    myArrayP[i]["nIDProdotto"] = _root.myDfor["IDProdotto"+i];
                    myArrayP[i]["nProdotto"] = _root.myDfor["Prodotto"+i];
                    myArrayP[i]["nDescrizione"] = _root.myDfor["Descrizione"+i];
                    myArrayP[i]["nIDFornitore"] = _root.myDfor["IDFornitore"+i];
                    myArrayP[i]["nquantit"] = _root.myDfor["quantit"+i];
                    myArrayP[i]["nPrezzo"] = _root.myDfor["Prezzo"+i];
                    myArrayP[i]["nCategoria"] = _root.myDfor["Categoria"+i];
                    myArrayP[i]["ndataodiernap"] = _root.myDfor["dataodiernap"+i];
                    myArrayP[i]["ncapacita"] = _root.myDfor["capacita"+i];
                    myArrayP[i]["nmarca"] = _root.myDfor["marca"+i];
                    myArrayP[i]["ncodProdotto"] = _root.myDfor["codProdotto"+i];
                    myArrayP[i]["ngestore"] = _root.myDfor["gestore"+i];
                }
            }
            trace(_global.cercapath);
        };
        myDfor.sendAndLoad(_global.cercapath, myDfor, "GET");
    };
    stop();
    nel trace
    codice:
    undefined
    undefined
    undefined
    undefined
    Error opening URL
    :master:

  7. #7
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    ok, ma dove sono le assegnazioni di quelle variabili???

  8. #8
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    2,929
    guarda visto che può dipendere da troppe cose ti mostro l'intero codice del frame solo _global.pathfile arriva dal primo frame della prima scena considera che nell'altro modo funziona benissimo e le variabili arrivano tutte

    codice:
    import mx.controls.Alert;
    // Preparo i DataGrid
    import mx.controls.gridclasses.DataGridColumn;
    
    risultatoLista.addColumn(new DataGridColumn("ID"));
    risultatoLista.addColumn(new DataGridColumn("Codice"));
    risultatoLista.addColumn(new DataGridColumn("Prodotto"));
    risultatoLista.addColumn(new DataGridColumn("PZ"));
    risultatoLista.getColumnAt(0).width = 30;
    risultatoLista.getColumnAt(1).width = 70;
    risultatoLista.getColumnAt(2).width = 200;
    risultatoLista.getColumnAt(3).width = 30;
    
    search.visible = false;
    cercaP.visible = false;
    
    var listener:Object = new Object();
    listener.click = function(evt:Object):Void
     {
        var name:String = evt.target._name;
        var chk:Boolean = evt.target.selected;
        switch (name) {
        case "cCodice" :
            cCategoria.enabled = !chk;
            // azioni
            _global.cercapath = _global.pathfile+"search/cercaProdottoCodice.php";
    		trace (_global.cercapath)
    		cercaP.text = "";
    		search.visible = true;
    		cercaP.visible = true;
    		risultatoLista.removeAll();
            break;
        case "cCategoria" :
            cCodice.enabled = !chk;
            // azioni
            _global.cercapath = _global.pathfile+"search/cercaProdottoCategoria.php";
    		trace (_global.cercapath)
    		cercaP.text = "";
    		search.visible = true;
    		cercaP.visible = true;
    		risultatoLista.removeAll();
            break;
        }
    };
    cCodice.addEventListener("click", listener);
    cCategoria.addEventListener("click", listener);
    
    
    search.onRelease = function() {
        trace(_global.pathfile);
        trace(_global.cercapath);
        myDfor = new LoadVars();
        myDfor.cercaP = cercaP.text;
        myDfor.onLoad = function(success) {
            trace(this.totale);
            var totale:Number = Number;
            var myArrayP:Array = new Array();
            for (i=1; i<=this.totale; i++) {
                myArrayP[i] = new Object();
                myArrayP[i]["nIDProdotto"] = _root.myDfor["IDProdotto"+i];
                myArrayP[i]["nProdotto"] = _root.myDfor["Prodotto"+i];
                myArrayP[i]["nDescrizione"] = _root.myDfor["Descrizione"+i];
                myArrayP[i]["nIDFornitore"] = _root.myDfor["IDFornitore"+i];
                myArrayP[i]["nquantit"] = _root.myDfor["quantit"+i];
                myArrayP[i]["nPrezzo"] = _root.myDfor["Prezzo"+i];
                myArrayP[i]["nCategoria"] = _root.myDfor["Categoria"+i];
                myArrayP[i]["ndataodiernap"] = _root.myDfor["dataodiernap"+i];
                myArrayP[i]["ncapacita"] = _root.myDfor["capacita"+i];
                myArrayP[i]["nmarca"] = _root.myDfor["marca"+i];
                myArrayP[i]["ncodProdotto"] = _root.myDfor["codProdotto"+i];
                myArrayP[i]["ngestore"] = _root.myDfor["gestore"+i];
                trace("["+i+"]"+"ID: "+myArrayP[i]["nIDProdotto"]+" Prodotto: "+myArrayP[i]["nProdotto"]+" Descrizione: "+myArrayP[i]["nDescrizione"]+" IDFornitore: "+myArrayP[i]["nIDFornitore"]+" Quantità: "+myArrayP[i]["nquantit"]+" Prezzo: "+myArrayP[i]["nPrezzo"]+" Categoria: "+myArrayP[i]["nCategoria"]+" Data Inserimento: "+myArrayP[i]["ndataodiernap"]+" Capacità: "+myArrayP[i]["ncapacita"]+" Marca: "+myArrayP[i]["nmarca"]+" Codice Prodotto: "+myArrayP[i]["ncodProdotto"]+" Gestore: "+myArrayP[i]["ngestore"]);
    			risultatoLista.addItem({ID:myArrayP[i]["nIDProdotto"], Codice:myArrayP[i]["ncodProdotto"], Prodotto:myArrayP[i]["nProdotto"], PZ:myArrayP[i]["nquantit"]});
            }
        };
        trace(_global.cercapath);
        myDfor.sendAndLoad(_global.cercapath, myDfor, "GET");
    };
    
    // Presione di una cella del DataGrid
    
    var myListener = new Object();
    myListener.change = function(event)
    {
    	var codice = event.target.selectedItem.Codice;
    	codic.text = codice;
    	
    	var ident = event.target.selectedItem.ID;
    	id.text = ident;
    
    	var prodc = event.target.selectedItem.Prodotto;
    	prod.text = prodc;
    
    	var pezzi = event.target.selectedItem.PZ;
    	pezziatt.text = pezzi;
    
    }
    risultatoLista.addEventListener("change",myListener);
    
    aggiorna.onRelease = function() {
        var pezzi:Number = Number(pezziatt.text);
        trace(npz.value+" "+pezzi);
        inviapezzi = Number(pezzi)+npz.value;
        trace(inviapezzi);
        myVars = new LoadVars();
        myVars.IDProdotto = id.text;
        myVars.quantit = inviapezzi;
        myVars.onLoad = function(success) {
            trace(myVars);
            if (success) {
                if (this.vailda) {
                    Alert.show(this.errorMsg, "COMPLIMENTI!!", Alert.OK, null, null, "alert_ico");
                }
            } else {
                Alert.show("Non è stato possibile inserire i dati, verificare i valori immessi o contattare l'aministatore", "ATTENZIONE!!", Alert.OK, null, null, "alert_ico");
            }
        };
        myVars.sendAndLoad(_global.pathfile+"/Aggiorna/aggiornaQuantita.php", myVars, "POST");
    };
    
    
    
    
    stop();
    :master:

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.