Visualizzazione dei risultati da 1 a 4 su 4

Discussione: problema con for

  1. #1

    problema con for

    Ciao a tutti ho creato un ciclo però avrei un esigenza e non so come impostare lo script:
    function pulsanti(){
    for(var i=0; i<n; i++){
    _root.mhome["bn"+i].mov(x,-3,6);
    }
    }
    dove mov è una funzione che mi fa spostare i miei pulsanti del menù tutti sulla stessa _y... ok finqui tutto bene la richiamo :
    _root.mhome.pulsanti();... però io dovrei far partire prima il primo poi il secondo poi il terzo e cosi via.... come faccio a strutturare questo script.. con un intervallo ? ma poi... no non so come fare grazie mille!

  2. #2
    esempio per 6 clip che si chiamano mc1....mc6


    codice:
    i=0
    targY=10
    this.onEnterFrame=function(){
        i++
    	if(i<=6){
    	   this["mc"+i].onEnterFrame=function(){
    		   if(this._y>targY){this._y-=10}
    		   else{this.y=targY;delete this.onEnterFrame}
    	   }
    	}
    }

  3. #3
    codice:
    function stessaY (){
    i=0
    targY=10
    this.onEnterFrame=function(){
        i++
    	if(i<=6){
    	   this["mc"+i].onEnterFrame=function(){
    		   if(this._y>targY){this._y-=10*i;}
    		   else{this._y=targY;delete this.onEnterFrame}
    	   }
    	}
    }
    }
    
    function stessaX (){
    i=0
    targX=10
    this.onEnterFrame=function(){
        i++
    	if(i<=6){
    	   this["mc"+i].onEnterFrame=function(){
    		   if(this._x>targX){this._x-=10*+i;}
    		   else{this._x=targX;delete this.onEnterFrame}
    	   }
    	}
    }
    }
    // Usage: 
       stessaX()	
       // stessaY()

  4. #4
    grazie mille ci provo subito e poi ti dico che dubbi ce ne saranno sicuramente!
    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.