ColorTween.prototype=new Tween();ColorTween.prototype.constructor=Tween;ColorTween.superclass=Tween.prototype;function ColorTween(obj,prop,func,fromColor,toColor,duration){this.targetObject=obj;this.targetProperty=prop;this.fromColor=fromColor;this.toColor=toColor;this.init(new Object(),'x',func,0,100,duration);this.listenerObj=new Object();this.listenerObj.onMotionChanged=Delegate.create(this,this.onColorChanged);this.addListener(this.listenerObj);}
var o=ColorTween.prototype;o.targetObject={};o.targetProperty={};o.fromColor='';o.toColor='';o.currentColor='';o.listenerObj={};o.onColorChanged=function(){this.currentColor=this.getColor(this.fromColor,this.toColor,this._pos);this.targetObject[this.targetProperty]=this.currentColor;}
o.getColor=function(start,end,percent)
{var r1=this.hex2dec(start.slice(0,2));var g1=this.hex2dec(start.slice(2,4));var b1=this.hex2dec(start.slice(4,6));var r2=this.hex2dec(end.slice(0,2));var g2=this.hex2dec(end.slice(2,4));var b2=this.hex2dec(end.slice(4,6));var pc=percent/100;r=Math.floor(r1+(pc*(r2-r1))+.5);g=Math.floor(g1+(pc*(g2-g1))+.5);b=Math.floor(b1+(pc*(b2-b1))+.5);return("#"+this.dec2hex(r)+this.dec2hex(g)+this.dec2hex(b));}
o.dec2hex=function(dec){return(this.hexDigit[dec>>4]+this.hexDigit[dec&15]);}
o.hexDigit=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");o.hex2dec=function(hex){return(parseInt(hex,16))};

