Visualizzazione dei risultati da 1 a 3 su 3

Discussione: aiuto su codice

  1. #1
    Utente bannato
    Registrato dal
    Sep 2005
    Messaggi
    121

    aiuto su codice

    ho trovato questo script per fare lo scrolling orizzontale di un testo, e ora vorrei far si che il testo venga preso da un file di testo esterno e nel primo frame ho messo:

    loadVariables("slogan.txt", "");
    nel file txt la variabile si chiama testo e richiamandola da un normale box di testo dinamico funzione.

    nello script seguente invece la variabile che contiene il testo si chiama n e come potete vedere io ho provato a mettere n=_root.testo ma non funz.

    mi potete aiutare?
    grazie


    codice:
    onClipEvent (load) {
    	
    	timedate = new Date();
    	currenttime = 0;
    	// time for the delay of the ticker letters
    	// 1 is very fast, 10 is very slow
    	timeleftset = 2;
    	delay == 1;
    	score = 1;
    	// initializes ticker line
    	settickerobject = function () {
    	j = 1;
    	i = 1;
    	p = "                               ";
    	s = p+n;
    	l = length(s);
    }
    	
    n = "Welcome to the dynamic news ticker tape.";
            
           n = _root.testo; // questo l'ho messo io
            
            settickerobject();
    }
    onClipEvent (enterFrame) {
    	currenttime = seconds;
    	seconds = timedate.getMilliseconds();
    	// if (length(seconds) == 1) {
    	// seconds = "0"+seconds;
    	// }
    	// sets up the strings to tick
    	// 
    	delete timedate;
    	timedate = new Date();
    	testtime = currenttime-seconds;
    	if (testtime != 0) {
    		timeleft = timeleft-2;
    		score = timeleft;
    		delay = 1;
    	}
    	if (timeleft<=0) {
    		timeleft = timeleftset;
    		delay = 0;
    		..:t = s.substr(i, l,40)
    		//other ways to do this string effect
    		//..:t = substring(s, i, l);
    		//..:t = substring(n, i, l)
    		// continues the string, or resets it using the function
    		if (Number(i)<=Number(l)) {
    			i = Number(i)+1;
    		} else {
    			settickerobject();
    		}
    
    	}
    }
    codice:
    loadVariables("slogan.txt", "");

  2. #2
    la soluzione è:

    codice:
    onClipEvent(load){
    	this.loadVariables("slogan.txt");
       
    }
    onClipEvent (data) {
    	 
    	timedate = new Date();
    	currenttime = 0;
    	// time for the delay of the ticker letters
    	// 1 is very fast, 10 is very slow
    	timeleftset = 5;
    	delay == 1;
    	score = 1;
    	// initializes ticker line
    	settickerobject = function () {
    	j = 1;
    	i = 1;
    	p = "                               ";
    	s = p+n;
    	l = length(s);
    }
    	//n = "Welcome to the dynamic variable speed ticker tape.";
    	 n = testo;
        settickerobject();
    }
    
    onClipEvent (enterFrame) {
    	currenttime = seconds;
    	seconds = timedate.getMilliseconds();
    	// if (length(seconds) == 1) {
    	// seconds = "0"+seconds;
    	// }
    	// sets up the strings to tick
    	// 
    	delete timedate;
    	timedate = new Date();
    	testtime = currenttime-seconds;
    	if (testtime != 0) {
    		timeleft = timeleft-2;
    		score = timeleft;
    		delay = 1;
    	}
    	if (timeleft<=0) {
    		timeleft = timeleftset;
    		delay = 0;
    		..:t = s.substr(i, l,40)
    		//other ways to do this string effect
    		//..:t = substring(s, i, l);
    		//..:t = substring(n, i, l)
    		// continues the string, or resets it using the function
    		if (Number(i)<=Number(l)) {
    			i = Number(i)+1;
    		} else {
    			settickerobject();
    		}
    
    	}
    }

  3. #3
    Utente bannato
    Registrato dal
    Sep 2005
    Messaggi
    121
    grande funzia da Dio!



    per l'ennesima volta hai risolto!

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.