Visualizzazione dei risultati da 1 a 5 su 5

Discussione: return

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    284

    return

    come si fa per ottenere piu valori con return

    cosi mi da sempre l' ultimo valore:

    es.return a,b,c;

    a,b,c, sono tre variabili di una funzione...

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    codice:
    return {a:a,b:b,c:c};
    cioè un oggetto con tre proprietà, a, b e c, che conterranno i valori di a, b e c risultanti dalla funzione.

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    284
    cosi mi funziona....mi sa che la sintassi però non è un gran che....vero?

    function centra_preload (path) {
    this.parent=path._parent._name;
    this.x=(parent._x/2);
    this.y=(parent._y/2);
    if (this.parent==""||this.parent==undefined) {
    this.parent=_root;
    this.x=(Stage.width/2);
    this.y=(Stage.height/2);
    }
    return {parent: parent,x:x,y:y};
    }

  4. #4
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Dovrebbe essere così:

    codice:
    function centra_preload (path) { 
    	this.parent=path._parent._name; 
    	this.x=(parent._x/2); 
    	this.y=(parent._y/2); 
    	if (this.parent==""||this.parent==undefined) { 
    		this.parent=_root; 
    		this.x=(Stage.width/2); 
    		this.y=(Stage.height/2); 
    	} 
    	return {parent:this.parent,x:this.x,y:this.y}; 
    }

  5. #5
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    284
    ok...grazie

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.