Visualizzazione dei risultati da 1 a 6 su 6

Discussione: adattare script

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

    adattare script

    Questo è un pezzo di script di uno analizzatore di spettro (quell'affare con le barrette che va in su e giu a seconda della musica) fatto da negatyve....

    codice:
    onClipEvent (load) {
    	fscommand ("allowscale", false);
    	eR = 96;
    	eG = 122;
    	eB = 140;
    	sR = sG=sB=255;
    	pR = Math.abs(Math.round((eR-sR)/30));
    	pG = Math.abs(Math.round((eG-sG)/30));
    	pB = Math.abs(Math.round((eB-sB)/30));
    	old = new Array();
    	for (i=0; i<14; i++) {
    		n = "bar"+i;
    		m = "pic"+i;
    		this.attachMovie("bar", n, i);
    		this.attachMovie("bar", m, 20+i);
    		this[n].colore = new Color(this[n]);
    		this[n]._x = this[m]._x=26+(i*5);
    		old[i] = getTimer();
    	}
    }
    onClipEvent (enterFrame) {
    	for (i=0; i<14; i++) {
    		val = Number(_level1["s"+i]);
    		n = "bar"+i;
    		m = "pic"+i;
    		if (_root.stato == "play") {
    			this[n]._height = val;
    			this[n].colore.setRGB((sR-pR*val) << 16 | (sG-pG*val) << 8 | (sB-pB*val));
    			if (this[m]._y>-val) {
    				this[m]._y = -val;
    				old[i] = getTimer();
    			}
    			if (getTimer()-old[i]>1000)this[m]._y -= this[m]._y/10;
    		} else if (_root.stato == "stop") {
    			this[m]._y = Math.abs(this[m]._y>0.5) ? this[m]._y++ : 0;
    			if (this[n]._height>0)this[n]._height--;
    		}
    	}
    }onClipEvent (load) {
    	fscommand ("allowscale", false);
    	eR = 96;
    	eG = 122;
    	eB = 140;
    	sR = sG=sB=255;
    	pR = Math.abs(Math.round((eR-sR)/30));
    	pG = Math.abs(Math.round((eG-sG)/30));
    	pB = Math.abs(Math.round((eB-sB)/30));
    	old = new Array();
    	for (i=0; i<14; i++) {
    		n = "bar"+i;
    		m = "pic"+i;
    		this.attachMovie("bar", n, i);
    		this.attachMovie("bar", m, 20+i);
    		this[n].colore = new Color(this[n]);
    		this[n]._x = this[m]._x=26+(i*5);
    		old[i] = getTimer();
    	}
    }
    onClipEvent (enterFrame) {
    	for (i=0; i<14; i++) {
    		val = Number(_level1["s"+i]);
    		n = "bar"+i;
    		m = "pic"+i;
    		if (_root.stato == "play") {
    			this[n]._height = val;
    			this[n].colore.setRGB((sR-pR*val) << 16 | (sG-pG*val) << 8 | (sB-pB*val));
    			if (this[m]._y>-val) {
    				this[m]._y = -val;
    				old[i] = getTimer();
    			}
    			if (getTimer()-old[i]>1000)this[m]._y -= this[m]._y/10;
    		} else if (_root.stato == "stop") {
    //l'errore è qui----------------->this[m]._y = Math.abs(this[m]._y>0.5) ? this[m]._y++ : 0;
    			if (this[n]._height>0)this[n]._height--;
    		}
    	}
    }onClipEvent (load) {
    	fscommand ("allowscale", false);
    	eR = 96;
    	eG = 122;
    	eB = 140;
    	sR = sG=sB=255;
    	pR = Math.abs(Math.round((eR-sR)/30));
    	pG = Math.abs(Math.round((eG-sG)/30));
    	pB = Math.abs(Math.round((eB-sB)/30));
    	old = new Array();
    	for (i=0; i<14; i++) {
    		n = "bar"+i;
    		m = "pic"+i;
    		this.attachMovie("bar", n, i);
    		this.attachMovie("bar", m, 20+i);
    		this[n].colore = new Color(this[n]);
    		this[n]._x = this[m]._x=26+(i*5);
    		old[i] = getTimer();
    	}
    }
    onClipEvent (enterFrame) {
    	for (i=0; i<14; i++) {
    		val = Number(_level1["s"+i]);
    		n = "bar"+i;
    		m = "pic"+i;
    		if (_root.stato == "play") {
    			this[n]._height = val;
    			this[n].colore.setRGB((sR-pR*val) << 16 | (sG-pG*val) << 8 | (sB-pB*val));
    			if (this[m]._y>-val) {
    				this[m]._y = -val;
    				old[i] = getTimer();
    			}
    			if (getTimer()-old[i]>1000)this[m]._y -= this[m]._y/10;
    		} else if (_root.stato == "stop") {
    			this[m]._y = Math.abs(this[m]._y>0.5) ? this[m]._y++ : 0;
    			if (this[n]._height>0)this[n]._height--;
    		}
    	}
    }onClipEvent (load) {
    	fscommand ("allowscale", false);
    	eR = 96;
    	eG = 122;
    	eB = 140;
    	sR = sG=sB=255;
    	pR = Math.abs(Math.round((eR-sR)/30));
    	pG = Math.abs(Math.round((eG-sG)/30));
    	pB = Math.abs(Math.round((eB-sB)/30));
    	old = new Array();
    	for (i=0; i<14; i++) {
    		n = "bar"+i;
    		m = "pic"+i;
    		this.attachMovie("bar", n, i);
    		this.attachMovie("bar", m, 20+i);
    		this[n].colore = new Color(this[n]);
    		this[n]._x = this[m]._x=26+(i*5);
    		old[i] = getTimer();
    	}
    }
    onClipEvent (enterFrame) {
    	for (i=0; i<14; i++) {
    		val = Number(_level1["s"+i]);
    		n = "bar"+i;
    		m = "pic"+i;
    		if (_root.stato == "play") {
    			this[n]._height = val;
    			this[n].colore.setRGB((sR-pR*val) << 16 | (sG-pG*val) << 8 | (sB-pB*val));
    			if (this[m]._y>-val) {
    				this[m]._y = -val;
    				old[i] = getTimer();
    			}
    			if (getTimer()-old[i]>1000)this[m]._y -= this[m]._y/10;
    		} else if (_root.stato == "stop") {
    			this[m]._y = Math.abs(this[m]._y>0.5) ? this[m]._y++ : 0;
    			if (this[n]._height>0)this[n]._height--;
    		}
    	}
    }
    io ho messo poi il filmato in as 2.0 e cosi facendo un funge +..
    e questo è l'errore...!!!!!!!!

    codice:
    **Errore** Scena=Controller, livello=contenitore, fotogramma=1:Linea 35: Tipo non corrispondente.
         			this[m]._y = Math.abs(this[m]._y>0.5) ? this[m]._y++ : 0;
    
    Totale errori ActionScript: 1 	 Errori segnalati: 1
    Ho provato a cambiare la riga di codice errata (in as 2.0) così

    codice:
    this[m]._y = Math.abs((this[m]._y>)0.5) ? this[m]._y++ : 0;
    ..ma non va lo stesso

    AIUTOOOO

    Avrei provate a farmelo anche da me ma non mi riesce..... :master:

  2. #2
    Utente bannato
    Registrato dal
    Dec 2003
    Messaggi
    448
    Proprio nexxuno??????

  3. #3
    Utente bannato
    Registrato dal
    Sep 2001
    Messaggi
    1,064
    Non serve fare up dopo appena 10 minuti, abbi pazienza.

  4. #4
    Utente bannato
    Registrato dal
    Dec 2003
    Messaggi
    448
    scusa

  5. #5
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    C'era una parentesi tonda fuori posto:

    codice:
    this[m]._y = Math.abs(this[m]._y) > 0.5 ? this[m]._y++ : 0;

  6. #6
    Utente bannato
    Registrato dal
    Dec 2003
    Messaggi
    448
    cosi facendo mi da altri 3 errori cmq o gia risolto....grazie lo stesso...

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.