Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 19 su 19
  1. #11
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Tutto nello stesso frame:

    codice:
    function Node(name, secondName, phone)
    {
    	this.name = name;
    	this.secondName = secondName;
    	this.phone = phone;
    	this.right = null; // figlio destro
    	this.left = null; // figlio sinistro
    	this.parent = null; // padre
    
    	return this; // restituisce il nodo
    }
    function binTree(name, secondName, phone)
    {
    	this.rootNode = new Node(name, secondName, phone); 
    	this.cardinality = 1;
    	return this;
    }
    binTree.prototype.visit = function (txt)
    {
    	this.visitNode = this.rootNode;
    	if (this.visitNode != null)
    	{
     		// this.visit(visitNode.left);
    		txt.text += this.visitNode.secondName;
    		// this.visit(visitNode.right);
     	} 	
    }
    
    albero = new binTree("naighes", "superNaighes", "144");
    trace(albero.rootNode.secondName);
    albero.visit(vis_txt);
    Il campo di testo:
    Immagini allegate Immagini allegate

  2. #12
    Negatyve, non mi funziona.
    Non mi resta che giocare l'ultima carta e provare ad allegare il fla...

    http://members.xoom.virgilio.it/naig...ighesProva.zip

    Ho tolto tutta la parte, per ora, in eccesso.
    Nel frattempo rinnovo i miei rigraziamenti.
    Nicola Baldi <% Naighes %>
    Il mio blog!

    "Non hai veramente capito qualcosa fino a quando non sei in grado di spiegarlo a tua nonna."

  3. #13
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Ma devi esportare per il flash5?

  4. #14
    Infatti l'ho provato in flash mx e funziona.
    Scusa negatyve, ma visto che non sono a conoscenza delle nuove funzionalità di flash mx utilizzo ancora flash 5...

    A tal proposito, mi chiedevo se potevi fornirmi un link (anche in inglese) dove vengano presentate tutte le nuove funzionalità di flash mx. Ho guardato queli presenti in www.flash-mx.it, ma mi interessava maggiormente da un punto di vista degli action script...

    In attesa di una tua risposta ti saluto e ti ringrazio.
    Nicola Baldi <% Naighes %>
    Il mio blog!

    "Non hai veramente capito qualcosa fino a quando non sei in grado di spiegarlo a tua nonna."

  5. #15
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    ok. Allora togli il nome di istanza al campo di testo, e scrivi "vis_txt" nel campo "Variable". Quindi scrivi:

    codice:
    function Node(name, secondName, phone)
    {
    	this.name = name;
    	this.secondName = secondName;
    	this.phone = phone;
    	this.right = null; // figlio destro
    	this.left = null; // figlio sinistro
    	this.parent = null; // padre
    
    	return this; // restituisce il nodo
    }
    function binTree(name, secondName, phone)
    {
    	this.rootNode = new Node(name, secondName, phone); 
    	this.cardinality = 1;
    	return this;
    }
    binTree.prototype.visit = function ()
    {
    	this.visitNode = this.rootNode;
    	if (this.visitNode != null)
    	{
     		// this.visit(visitNode.left);
    		_root.vis_txt += this.visitNode.secondName;
    		// this.visit(visitNode.right);
     	} 	
    }
    
    albero = new binTree("naighes", "superNaighes", "144");
    trace(albero.rootNode.secondName);
    albero.visit();
    Per quanto riguarda le nuove funzionalità, sono centinaia. Il modo migliore di vederle, e guardare nel manuale quali azioni ci sono in più, ed eventualmente chiedere per le singole. Sai l'inglese?

  6. #16
    Caro negatyve, ti voglio disturbare un'ultima volta... quest'oggi!
    Ho fatto qualche provetta ed ho pensato ad una soluzione del genere:
    (la tua funziona, ma sono curioso!)

    Nel keyFrame di inizializzazione della classe:

    codice:
    binTree.prototype.visit = function ()
    {		
     	this.strReturn = ""; // una stringa vuota
     	this.visitPtr(this.rootNode); // Chiamo la procedura e passo la radice
    }
    
    binTree.prototype.visitPtr = function (visitNode)
    {
    	if (visitNode != null)
    	{
    		//this.visitPtr(visitNode.left, txt);
    		this.strReturn += this.visitNode.secondName; // Incremento la stringa
    		//this.visitPtr(visitNode.right, txt);
     	}
    	else
    	{
    		// Qui mi gestirò poi l'eccezione...
    	}
    	return this.strReturn; // e la restituisco la stringa che prima era vuota
    }
    Di primo acchito sembrerebbe tutto perfetto.

    Mi creo l'oggetto...

    codice:
    albero = new binTree("naighes", "superNaighes", "144");
    ...e gestisco il pulsante:

    codice:
    on(release)
    {
    	vis_txt = albero.visit(); // e qui dovrebbe ricevere la stringa...
    }
    Piazzo infine sullo stage una bella casella di testo dinamico con nome variabile (non nome istanza) vis_txt.

    Semplice, no?
    E invece, non funziona...

    PS. Sì, me la cavo con l'inglese.
    Nicola Baldi <% Naighes %>
    Il mio blog!

    "Non hai veramente capito qualcosa fino a quando non sei in grado di spiegarlo a tua nonna."

  7. #17
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    ma quante ne fai.. :)

    codice:
    function Node(name, secondName, phone)
    {
    	this.name = name;
    	this.secondName = secondName;
    	this.phone = phone;
    	this.right = null; // figlio destro
    	this.left = null; // figlio sinistro
    	this.parent = null; // padre
    }
    function binTree(name, secondName, phone)
    {
    	this.rootNode = new Node(name, secondName, phone);
    	this.cardinality = 1;
    }
    binTree.prototype.visit = function ()
    {		
     	this.strReturn = ""; // una stringa vuota
     	return this.visitPtr(this.rootNode); 
    }
    
    binTree.prototype.visitPtr = function (visitNode)
    {
    	if (visitNode != null)
    	{
    		//this.visitPtr(visitNode.left, txt);
    		this.strReturn += visitNode.secondName; 
    		//this.visitPtr(visitNode.right, txt);
     	}
    	else
    	{
    		// Qui mi gestirò poi l'eccezione...
    	}
    	return this.strReturn; // e la restituisco la stringa che prima era vuota
    }
    albero = new binTree("naighes", "superNaighes", "144");
    vis_txt = albero.visit(); // e qui dovrebbe ricevere la stringa...
    ATTENTO:

    tu hai usato questa riga:

    codice:
    this.strReturn += this.visitNode.secondName
    ma è sbagliata, perchè vistNode è una variabile locale passata alla funzione, quindi:

    codice:
    this.strReturn += visitNode.secondName
    senza il this.
    Poi, la funzione visit non restituisce niente:

    codice:
    binTree.prototype.visit = function ()
    {		
     	this.strReturn = "";
     	return this.visitPtr(this.rootNode);
    }
    e allora come fa a riempire il campo di testo? Quindi, visitPtr restutisce un valore, e visit a sua volta lo deve restituire.

    codice:
    binTree.prototype.visit = function ()
    {		
     	this.strReturn = "";
     	var nuovoValore = this.visitPtr(this.rootNode);
    	return nuovoValore;
    }
    contratto:

    codice:
    binTree.prototype.visit = function ()
    {		
     	this.strReturn = "";
    	return this.visitPtr(this.rootNode);
    }

  8. #18
    WOW!
    Sia lodata l'inseauribile pazienza che hai mostrato nei miei confronti all'interno di questo post (e non solo..).

    Ti ringrazio ancora.
    Nicola Baldi <% Naighes %>
    Il mio blog!

    "Non hai veramente capito qualcosa fino a quando non sei in grado di spiegarlo a tua nonna."

  9. #19

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 © 2026 vBulletin Solutions, Inc. All rights reserved.