Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/03/2005, 09:20
Avatar de nodream
nodream
 
Fecha de Ingreso: septiembre-2003
Mensajes: 134
Antigüedad: 20 años, 6 meses
Puntos: 2
He notado un error en el codigo, la nueva version es

Código:
MovieClip.prototype.setColor = function(cambiar:Boolean,R:Number,G:Number,B:Number)
{
  
  myCol = new Color(this);
  allColors = new Object();
  allColors = myCol.getTransform();
  red = allColors.rb;
  green = allColors.gb;
  blue = allColors.bb;
  
  this.onEnterFrame = function()
  {
	 velocidad=5; //por ejemplo. A mayor valor menor velocidad.;
  	 red+=(R-red)/velocidad;
 	 green+=(G-green)/velocidad;
 	 blue+=(B-blue)/velocidad;

	 var myObj:Object = { ra: 0, rb: red, ga: 0, gb: green, ba: 0, bb: blue, aa: 100, ab: 0};
	 
	 myCol.setTransform(myObj);

	 if(Math.round(red)==R && Math.round(green)==G && Math.round(blue)==B)
	  {delete this.onEnterFrame;}
	
  };
};

Última edición por nodream; 23/03/2005 a las 09:23