hello all,
I have a client who would like to have all the text on the site transition from one color to the next at the same time. I hacked up bits and pieces of code and came up with this for one text field:
this does cycle through my colors but at the end of an interval there is a bump or a skip so the transition is interupted with what looks like a flicker.Code:import fl.transitions.Tween; import fl.transitions.TweenEvent; import fl.transitions.easing.Strong; import fl.motion.Color; import flash.events.Event; import flash.geom.ColorTransform; changeColor(); var c:Number = 0; var tfs:Number=4; //number of text fields. function changeColor() { var colorInfo:ColorTransform=ex_txt.transform.colorTransform; var alphaOver:Tween=new Tween(ex_txt,"alpha",Strong.easeInOut,0,1,5,true); if (c==0) { c++; //gray to red }else if(c==1){ c++; //red to gray }else if(c==2){ c++; //gray to blue }else if(c==3){ c++; //blue to gray }else if(c==4){ c=0; } var text_color:uint=0x999999; var final_color:Array = new Array(); final_color[0] = 0x999999; //gray final_color[1] = 0xFF0000; //red final_color[2] = 0x0066CC; //blue final_color[3] = 0xFF66CC; //pink final_color[4] = 0x00CC66; //green final_color[5] = 0x999999; //gray alphaOver.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinal); function tweenToFinal(event:TweenEvent):void { colorInfo.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position); ex_txt.transform.colorTransform=colorInfo; } } setInterval(changeColor, 6000);
Any ideas how to fix this??
Bookmarks