Visualizzazione dei risultati da 1 a 3 su 3

Discussione: un funge [text]

  1. #1
    Utente bannato
    Registrato dal
    Dec 2003
    Messaggi
    448

    un funge [text]

    codice:
    onClipEvent (enterFrame) {
    	this.onPress = function() {
    		if (this.text1="on") {
    			this.text1 = "off";
    			myFormat = new TextFormat();
    			myFormat.color = "0xff0000";
    			this.text.setTextFormat(myFormat);
    		} else if (this.text1="off") {
    			this.text1 = "on";
    			myFormat1 = new TextFormat();
    			myFormat1.color = "0x00ff00";
    			this.text.setTextFormat(myFormat1);
    		}
    	};
    }
    Va solo se this.text1 è uguale a "on";
    se poi ci ripigio dato che è diventato off non ridiventa on.
    Eppure è perfetto!!!

  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    non ho analizzato quello che fa lo script comunque la sintassi per confrontare gli if è == e non =

    codice:
    onClipEvent (enterFrame) {
    	this.onPress = function() {
    		if (this.text1=="on") {
    			this.text1 = "off";
    			myFormat = new TextFormat();
    			myFormat.color = "0xff0000";
    			this.text.setTextFormat(myFormat);
    		} else if (this.text1=="off") {
    			this.text1 = "on";
    			myFormat1 = new TextFormat();
    			myFormat1.color = "0x00ff00";
    			this.text.setTextFormat(myFormat1);
    		}
    	};
    }

  3. #3
    Utente bannato
    Registrato dal
    Dec 2003
    Messaggi
    448
    oddio ke imbecille è vero

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.