Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    641

    chiarimento su proto di And80 o enigma_79

    ciao,
    tempo fa avevo aperto una discussione e, non ricordo se And80 o enigma_79 ( :master: o forse qualcun altro), mi avevano passato una proto. purtroppo non posso inserire il link della vecchia discussione perchè non funziona il search.

    il problema è che la proto non esce dal enterframe. ho provato a modificarla ma... non riesco a bloccarla e così ho la CPU che mi spara a mille.

    la proto in questione è la seguente:

    codice:
    MovieClip.prototype.funzione= function (x,y,a,sx,sy,steps) {
    	this.onEnterFrame=function () {
    		this._xstep=(Number(x)-this._x)/Number(steps);
    	        this._ystep=(Number(y)-this._y)/Number(steps);
                    this._rot=(Number(a)-this._rotation)/Number(steps);		
                    this._xsca=(Number(sx)-this._xscale)/Number(steps);
    	        this._ysca=(Number(sy)-this._yscale)/Number(steps);
    	        this._steps=steps;
    		if (this._xstep != Number(x)) {
    			this._rotation+=this._rot;
    			this._alpha+=10;
    			this._x+=this._xstep;
    			this._y+=this._ystep;
    			this._xscale+=this._xsca;
    			this._yscale+=this._ysca;
    			this._steps--;
    		}
    		else {
    			delete this._xstep;
    			delete this._ystep;
    			delete this._xsca;
    			delete this._ysca;
    			delete this._steps;
    			this.onEnterFrame=function () {}
    		}
    	}
    }

  2. #2
    lo script se nn sbaglio te lo ho passato io

    ma da me la CPU con qlla proto dopo il movimento rimane a zero

    quindi sarà altro a farti schizzare la CPU
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    641
    allora non mi sbagliavo, ero quasi convinta fosse tua

    il problema è che non entra mai nell'else. ho messo i trace e non ci va, quindi continua a ripetere l'onEnterFrame. il fatto è che se hai 1 mc al quale dai questa funzione, non ci sono problemi ma...io faccio fare quell'azione a 200 mc VVoVe: . e quindi mi crea mooooooooolti problemi di CPU.


  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    641
    ho modificato in questo modo e ora si blocca senza mangiarsi tutta la CPU.

    codice:
    MovieClip.prototype.funzione= function (x,y,a,sx,sy,steps) {
    	this._xstep=(Number(x)-this._x)/Number(steps);
    	this._ystep=(Number(y)-this._y)/Number(steps);
    	this._rot=(Number(a)-this._rotation)/Number(steps);		
    	this._xsca=(Number(sx)-this._xscale)/Number(steps);
    	this._ysca=(Number(sy)-this._yscale)/Number(steps);
    	this._steps=steps;
    	this.onEnterFrame=function () {
    		if (this._steps) {
    			this._rotation+=this._rot;
    			this._alpha+=10;
    			this._x+=this._xstep;
    			this._y+=this._ystep;
    			this._xscale+=this._xsca;
    			this._yscale+=this._ysca;
    			this._steps--;
    		}else {
    			delete this._xstep;
    			delete this._ystep;
    			delete this._xsca;
    			delete this._ysca;
    			delete this._steps;
    			delete this.onEnterFrame
    		}
    	}
    }
    grazie

  5. #5
    Originariamente inviato da mic
    ho modificato in questo modo e ora si blocca senza mangiarsi tutta la CPU.

    codice:
    MovieClip.prototype.funzione= function (x,y,a,sx,sy,steps) {
    	this._xstep=(Number(x)-this._x)/Number(steps);
    	this._ystep=(Number(y)-this._y)/Number(steps);
    	this._rot=(Number(a)-this._rotation)/Number(steps);		
    	this._xsca=(Number(sx)-this._xscale)/Number(steps);
    	this._ysca=(Number(sy)-this._yscale)/Number(steps);
    	this._steps=steps;
    	this.onEnterFrame=function () {
    		if (this._steps) {
    			this._rotation+=this._rot;
    			this._alpha+=10;
    			this._x+=this._xstep;
    			this._y+=this._ystep;
    			this._xscale+=this._xsca;
    			this._yscale+=this._ysca;
    			this._steps--;
    		}else {
    			delete this._xstep;
    			delete this._ystep;
    			delete this._xsca;
    			delete this._ysca;
    			delete this._steps;
    			delete this.onEnterFrame
    		}
    	}
    }
    grazie
    infatti nn mi ero accorto di aver scritto
    this.onEnterFrame=function () {}


    al posto di delete this.onEnterFrame
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  6. #6
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    641
    oltre a quello... ho dovuto spostare anche

    codice:
    this._xstep=(Number(x)-this._x)/Number(steps);
    this._ystep=(Number(y)-this._y)/Number(steps);
    this._rot=(Number(a)-this._rotation)/Number(steps);		
    this._xsca=(Number(sx)-this._xscale)/Number(steps);
    this._ysca=(Number(sy)-this._yscale)/Number(steps);
    this._steps=steps;
    tra function e onEnterFrame. se li lasciavo dentro onEnterFrame faceva casotto.

    grazie mille per la risorsa e il tempo di oggi

  7. #7
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    641
    :master: sono nel pallone!
    io ho usato la proto sotto e la dichiaro nel mio livello action.
    la associo ad una serie di mc che duplico così:
    codice:
    alberoDin = new LoadVars(); 
    alberoDin.onLoad = function(success) { 
      if(success){
        _global.totSquare = Number(alberoDin.sqTreeTot)
        for(sqTreeDupl=0;sqTreeDupl<alberoDin.sqTreeTot;sqTreeDupl++){
          duplicateMovieClip("sqTree", "sqTree"+sqTreeDupl,1+sqTreeDupl)
          _root.sqTree._x = 166.4;
          _root.sqTree._y = 115.6;
          _root.sqTree._visible = false;
          squareSetEndX = alberoDin.squareSetEndX;
          squareSetEndY = alberoDin.squareSetEndY;
    			
          squareTreeSet = alberoDin["sqTree"+sqTreeDupl].split(";");
          _global.squareX = squareTreeSet[0];
          _global.squareY = squareTreeSet[1];
    			
          _root["sqTree"+sqTreeDupl]._x = Number(squareX) + _root.sqTree._x;
          _root["sqTree"+sqTreeDupl]._y = Number(squareY) + _root.sqTree._y;
         }
      }else{
        trace("non carica")
      }
    }
    alberoDin.load("treeSquare.txt");
    il mio file txt è così composto:
    codice:
    &sqTreeTot=226&
    &squareSetEndX=390&
    &squareSetEndY=520&
    
    &sqTree0=133.1;6.8;-180;dimx;dimy;10&
    &sqTree1=119.3;14.4;-90;dimx;dimy;25&
    ...
    ...
    in ordine sono: x;y;rotazione;dimensione x; dimensione Y; step

    la proto parte onPress di un pulsante e la richiamo in questo modo:
    codice:
    for(i=0;i<totSquare;i++){
       squareTreeSetnew = alberoDin["sqTree"+i].split(";");
       squareRotation = squareTreeSetnew[2];
       squareDimX = squareTreeSetnew[3];
       squareDimY = squareTreeSetnew[4];
       squareStep = squareTreeSetnew[5];
       _root["sqTree"+i].animaTreeFrw(squareSetEndX,squareSetEndY,squareRotation,10,100,100,squareStep);
    }
    fin qui tutto ok.

    ora vorrei che onPress di un altro bottone, ci fosse il rewind della proto e che ogni mc duplicato ritornasse alla posizione iniziale. non riesco in nessun modo


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.