Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Tween color change for text field problem

This is a discussion on Tween color change for text field problem within the advanced Actionscript 3.0 forums, part of the Flash CS3 eng category; hello all, I have a client who would like to have all the text on the site transition from one ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > advanced Actionscript 3.0

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-10-08, 02:47
Junior Member
 
Join Date: Oct 2008
Posts: 2
Rep Power: 0
samohtwerdna is on a distinguished road
Tween color change for text field problem

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:
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);
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.

Any ideas how to fix this??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Actionscript 3 Insert a gap into a text field at runtime kativo advanced Actionscript 3.0 0 10-09-08 08:06
Actionscript 2 Trying to change the color of Dynamic text Dakart Flash CS3 eng 0 18-07-08 20:49
Actionscript 3 Text Field in AS3 sututuyet advanced Actionscript 3.0 0 27-06-08 03:59
Change Text color alexyz4 Flash CS3 eng 4 31-10-07 08:28
change color to movieclip billyboo Flash CS3 eng 7 25-10-07 09:22


All times are GMT. The time now is 20:53.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406