Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 18 su 18
  1. #11
    Il cod lo puoi postare, anche se ho notato che stampa 2 volte "terza prova" se avvio 2 volte il tuo filmato.

  2. #12
    beh effettivamente sorge ancora qualche problema quando l'effetto viene richiamato prima che quello precedente vanga terminato....

    cmq il cod
    Codice PHP:
    function onEndEffect(cont) { 
        
    trace("finito"); 
        
    cont=0
        
    //azioni da far fare alla fine dell'animazione del testo 

    function 
    returnLetter(array:Array):String 
        var 
    rand Math.floor(Math.random()*array.length); 
        var 
    actual = array[rand]; 
        array.
    splice(rand1); 
        return 
    actual

    function 
    initializeVariable():Array { 
        
    //var letters:String = new String("abcdefghjkilmnopqrstuvwxyzABCDEFGHJKILMNOPQRSTUVWXYZàèéìòù ,.-;:_|!\"£$%&/()=?^1234567890'ì"); 
        
    var letters:String = new String("abcdefghjkilmnopqrstuvwxyzABCDEFGHJKILMNOPQRSTUVWXYZ.- 1234567890"); 
         
        var 
    ltArray:Array = letters.split(""); 
        var 
    shArray:Array = new Array(); 
        var 
    ltArray.length
        while (
    i>0) { 
            var 
    shaker Math.floor(Math.random()*ltArray.length); 
            
    shArray.push(ltArray[shaker]); 
            
    ltArray.splice(shaker1); 
            
    i--; 
        } 
        return 
    shArray

    function 
    shakeEffect(tfield:TextFieldprec:Stringto:Stringchi:Array,cont) { 
        var 
    sh initializeVariable();
        
    temp= new Array()
        
    temp=chi;
        
    trace("to="+to)
        
    trace(index)
        
    trace(cont)
        var 
    interval setInterval(function () { 
            var 
    returnLetter(sh); 
            
    tfield.text prec+l
            
    trace(temp.length-1)
            
    //trace("chi.length-1="+Number(chi.length)-1)
            
    if (== to) { 
                
    clearInterval(interval); 
                
    tfield.text prec+l
                
                
    temp1=cont
                cont
    ++
                (
    temp1>=temp.length-1) ? onEndEffect(cont) : shakeEffect(tfieldprec+ltemp[cont],temp,cont); 
            }     
        }, 
    1); 



    var 
    index:Number 0
    var 
    f:String "Funziona vedi bene "

    var 
    string:Array = f.split(""); 
    shakeEffect(t""string[index],string,index); 


    var 
    s1 "questa prova"
    var 
    string1:Array = s1.split(""); 

    var 
    s2 "questa terza prova"
    var 
    string2:Array = s2.split(""); 

    bt.onRelease=function(){
        
        
    trace(string1)
        
    mio=0
        trace
    ("chi.length-1="+string1.length)
        
    shakeEffect(t1""string1[index],string1,mio); 
        
    }


    bt1.onRelease=function(){
        
        
    trace(string1)
        
    index1=0
        trace
    ("chi.length-1="+string1.length)
        
    shakeEffect(t2""string2[index],string2,index1); 
        

    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  3. #13
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    Ho visto ieri tardi la classe di cui parlavo, ma non va bene, è una singleton praticamente inutile per questa situazione, sew riesco più tardi metto in classe direttamente il primo codice postato modificando onEnterFrame con setInterval.

  4. #14
    Grazie Crescenzo, ma purtroppo niente da fare
    I campi da due sono diventati cinque, adesso ho bisogno per forza di una classe.

    Comunque ho provato a fare questa schifezza con setInterval, e funziona, chiaramente sempre e solo su un campo ma non confronta le 2 stringhe new_text e testo :master:
    codice:
    	function matrix (testo:String, obbiettivo:TextField, lungTesto:Number){
    		if (new_text==testo){
    			trace("Fatto.")
    			demo.clearInterval();
    		}
    		testorand = "";
    		for (i=0;i<lungTesto;i++){
    			testorand += chr(Math.floor(Math.random()*(123-65))+65); 
    		}
    // DUBBIO SU PARENT E THIS
    		_parent[obbiettivo].htmlText = testorand;
    
    		timer++;
    		if(timer>delay){
    			random_position = substring(testorand,count,lungTesto);
    			text_position = substring(testo,0,count);
    			new_text = text_position + random_position;
    
    // DUBBIO SU PARENT E THIS
    			_parent[obbiettivo].htmlText = new_text;
    
    			trace(new_text)
    			count += speed;
    		}
    	}
    _global.matrixTween = function(testo, obbiettivo){
    	delay=20;
    	count=0;
    	speed=1;
    	timer=0;
    	lungTesto = testo.length;
    	demo=setInterval(matrix, 0, testo, obbiettivo, lungTesto);
    }
    Che casino!

  5. #15
    nessuna novità?

  6. #16
    Mi avete decisamente abbandonato...

  7. #17
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    Sulla base della funzione che hai scritto nel primo psot ho sviluppato questa semplice classe singleton che attraverso la funzione addTween genera lo stesso effetto su più textfield in maniera contemporanea.
    La classe non va istanziata, basta semplicemente richiamare attraverso il suo nome la funzione addTween e il resto lo gestisce lei stessa internamente.
    La classe è questa e va inserita in un file matrixTween.as da mettere nella stessa cartella del fla su cui va usata:
    Codice PHP:
    class matrixTween {
        private static  var 
    tweens:Array=[];
        private static  function 
    init () {
            var 
    obj:Object=tweens[tweens.length 1];
            
    obj.speed obj.hasOwnProperty("speed") ? obj["speed"] : 1;
            
    obj.delay obj.hasOwnProperty("delay") ? obj["delay"] : 1;
            
    obj.count 0;
            
    obj.timer 0;
            
    obj.lungTesto obj.hasOwnProperty("testo") ? obj["testo"].length 0;
            
    obj.intervalID setInterval(iterator20obj);
        }
        private static  function 
    iterator (obj:Object) {
            
    obj.testorand="";
            for (
    obj.index=0obj.index obj.lungTestoobj.index++) {
                
    obj.testorand+= chr(Math.floor(Math.random() * 123 65) + 65);
            }
            
    obj.target.htmlTextobj.testorand;
            
    obj.timer++;
            if (
    obj.timer obj.delay) {
                
    obj.random_position=substring(obj.testorand,obj.count,obj.lungTesto);
                
    obj.text_position=substring(obj.testo,0,obj.count);
                
    obj.new_text=obj.text_position obj.random_position;
                
    obj.target.htmlText=obj.new_text;
                
    obj.count+= obj.speed;
                if (
    obj.new_text == obj.testo) {
                    
    clearInterval (obj.intervalID);
                }
            }
        }
        public static  function 
    addTween (tf:TextField,obj:Object) {
            if (
    obj != null) {
                
    obj.target=tf;
                
    tweens.push (obj);
            }
            
    init ();
        }

    E si usa così:
    Codice PHP:
    matrixTween.addTween(campotesto1, {testo:"Ciao da me che sono io"});
    matrixTween.addTween(campotesto2, {testo:"Sono Mario"}); 
    Considerato che l'oggetto passato alla funzione è variabile, puoi tranquillamente modificare le proprietà delay, speed ecc... richiamandole dentro all'oggetto:
    matrixTween.addTween(esempio, {testo:"Esempio", delay:50, speed:1.2});

  8. #18
    Grazie!
    Sei un grande!!!

    PS.Scusa i vari pressing!

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.