help Get rid of flicker on ColorTransform text

  • samohtwerdna
  • Novice
  • Novice
  • User avatar
  • Posts: 17
  • Loc: Denver, Colorado

Post 3+ Months Ago

Hello all,

I have set up a flash site with 4 pages - each page has text on it that cycles through 4 colors. I did this by using ColorTransform and set and interval for the function to fire every 6 seconds.

Promblem: the text flickers every six seconds!! yuck.

can some one help me understand how to get rid of the flicker?
I'm sure there are better ways to achieve what I want.

Anyway here is my code:
ACTIONSCRIPT Code: [ Select ]
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.Regular;
import fl.transitions.easing.Strong;
import fl.motion.Color;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
import flash.geom.ColorTransform;
 
 
var c:Number = -1;
//changeColor();
 function changeColor()
 {
    if(c<4){
        c++
    }else{
        c=0;
    }
        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
       
        var colorInfo:ColorTransform=menu_mc.company_txt.transform.colorTransform;
        var colorInfoEx:ColorTransform=menu_mc.exhibit_txt.transform.colorTransform;
        var colorInfoCn:ColorTransform=menu_mc.contact_txt.transform.colorTransform;
        if(currentFrame==2){
            var colorInfoAb:ColorTransform=about_mc.tf_txt.transform.colorTransform;
            var alphaOverAb:Tween=new Tween(about_mc.tf_txt,"alpha",Regular.easeInOut,0,1,3,true);
            alphaOverAb.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinalAb);
           
            function tweenToFinalAb(event:TweenEvent):void
            {
   
                colorInfoAb.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                about_mc.tf_txt.transform.colorTransform=colorInfoAb;
               
            }   
        }
       
        if(currentFrame==3){
            var colorInfoXb:ColorTransform=exhibits_mc.ex_txt.transform.colorTransform;
            var colorInfoNx:ColorTransform=exhibits_mc.next_txt.transform.colorTransform;
            var colorInfoPs:ColorTransform=exhibits_mc.pause_txt.transform.colorTransform;
            var colorInfoPr:ColorTransform=exhibits_mc.prev_txt.transform.colorTransform;
       
           
           
            var alphaOverEx:Tween=new Tween(exhibits_mc.ex_txt,"alpha",Regular.easeInOut,0,1,3,true);
            alphaOverEx.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinalEx);
           
            function tweenToFinalEx(event:TweenEvent):void
            {
   
                colorInfoXb.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                exhibits_mc.ex_txt.transform.colorTransform=colorInfoXb;
                colorInfoNx.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                exhibits_mc.next_txt.transform.colorTransform=colorInfo;
                colorInfoPs.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                exhibits_mc.pause_txt.transform.colorTransform=colorInfo;
                colorInfoPr.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                exhibits_mc.prev_txt.transform.colorTransform=colorInfo;
               
            }   
        }
       
        if(currentFrame==4){
            var colorInfoCt:ColorTransform=cnt_mc.ct_txt.transform.colorTransform;
            var colorInfoMl:ColorTransform=cnt_mc.email_txt.transform.colorTransform;
            var alphaOverCt:Tween=new Tween(cnt_mc.ct_txt,"alpha",Regular.easeInOut,0,1,3,true);
            alphaOverCt.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinalCt);
           
            function tweenToFinalCt(event:TweenEvent):void
            {
   
                colorInfoCt.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                colorInfoMl.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
                cnt_mc.ct_txt.transform.colorTransform=colorInfoCt;
                cnt_mc.email_txt.transform.colorTransform=colorInfoMl;
               
            }   
        }
       
        var alphaOver:Tween=new Tween(menu_mc.company_txt,"alpha",Regular.easeInOut,0,1,3,true);
        alphaOver.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinal);
       
        function tweenToFinal(event:TweenEvent):void
        {
            colorInfo.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
            menu_mc.company_txt.transform.colorTransform=colorInfo;
            colorInfoEx.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
            menu_mc.exhibit_txt.transform.colorTransform=colorInfo;
            colorInfoCn.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
            menu_mc.contact_txt.transform.colorTransform=colorInfo;
       
   
        }   
       
 }
setInterval(changeColor,6000);
  1. import fl.transitions.Tween;
  2. import fl.transitions.TweenEvent;
  3. import fl.transitions.easing.Regular;
  4. import fl.transitions.easing.Strong;
  5. import fl.motion.Color;
  6. import flash.utils.Timer;
  7. import flash.events.TimerEvent;
  8. import flash.events.Event;
  9. import flash.geom.ColorTransform;
  10.  
  11.  
  12. var c:Number = -1;
  13. //changeColor();
  14.  function changeColor()
  15.  {
  16.     if(c<4){
  17.         c++
  18.     }else{
  19.         c=0;
  20.     }
  21.         var final_color:Array = new Array();
  22.         final_color[0] = 0x999999; //gray
  23.         final_color[1] = 0xFF0000; //red
  24.         final_color[2] = 0x0066CC; //blue
  25.         final_color[3] = 0xFF66CC; //pink
  26.         final_color[4] = 0x00CC66; //green
  27.         final_color[5] = 0x999999; //gray
  28.        
  29.         var colorInfo:ColorTransform=menu_mc.company_txt.transform.colorTransform;
  30.         var colorInfoEx:ColorTransform=menu_mc.exhibit_txt.transform.colorTransform;
  31.         var colorInfoCn:ColorTransform=menu_mc.contact_txt.transform.colorTransform;
  32.         if(currentFrame==2){
  33.             var colorInfoAb:ColorTransform=about_mc.tf_txt.transform.colorTransform;
  34.             var alphaOverAb:Tween=new Tween(about_mc.tf_txt,"alpha",Regular.easeInOut,0,1,3,true);
  35.             alphaOverAb.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinalAb);
  36.            
  37.             function tweenToFinalAb(event:TweenEvent):void
  38.             {
  39.    
  40.                 colorInfoAb.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  41.                 about_mc.tf_txt.transform.colorTransform=colorInfoAb;
  42.                
  43.             }   
  44.         }
  45.        
  46.         if(currentFrame==3){
  47.             var colorInfoXb:ColorTransform=exhibits_mc.ex_txt.transform.colorTransform;
  48.             var colorInfoNx:ColorTransform=exhibits_mc.next_txt.transform.colorTransform;
  49.             var colorInfoPs:ColorTransform=exhibits_mc.pause_txt.transform.colorTransform;
  50.             var colorInfoPr:ColorTransform=exhibits_mc.prev_txt.transform.colorTransform;
  51.        
  52.            
  53.            
  54.             var alphaOverEx:Tween=new Tween(exhibits_mc.ex_txt,"alpha",Regular.easeInOut,0,1,3,true);
  55.             alphaOverEx.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinalEx);
  56.            
  57.             function tweenToFinalEx(event:TweenEvent):void
  58.             {
  59.    
  60.                 colorInfoXb.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  61.                 exhibits_mc.ex_txt.transform.colorTransform=colorInfoXb;
  62.                 colorInfoNx.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  63.                 exhibits_mc.next_txt.transform.colorTransform=colorInfo;
  64.                 colorInfoPs.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  65.                 exhibits_mc.pause_txt.transform.colorTransform=colorInfo;
  66.                 colorInfoPr.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  67.                 exhibits_mc.prev_txt.transform.colorTransform=colorInfo;
  68.                
  69.             }   
  70.         }
  71.        
  72.         if(currentFrame==4){
  73.             var colorInfoCt:ColorTransform=cnt_mc.ct_txt.transform.colorTransform;
  74.             var colorInfoMl:ColorTransform=cnt_mc.email_txt.transform.colorTransform;
  75.             var alphaOverCt:Tween=new Tween(cnt_mc.ct_txt,"alpha",Regular.easeInOut,0,1,3,true);
  76.             alphaOverCt.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinalCt);
  77.            
  78.             function tweenToFinalCt(event:TweenEvent):void
  79.             {
  80.    
  81.                 colorInfoCt.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  82.                 colorInfoMl.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  83.                 cnt_mc.ct_txt.transform.colorTransform=colorInfoCt;
  84.                 cnt_mc.email_txt.transform.colorTransform=colorInfoMl;
  85.                
  86.             }   
  87.         }
  88.        
  89.         var alphaOver:Tween=new Tween(menu_mc.company_txt,"alpha",Regular.easeInOut,0,1,3,true);
  90.         alphaOver.addEventListener(TweenEvent.MOTION_CHANGE,tweenToFinal);
  91.        
  92.         function tweenToFinal(event:TweenEvent):void
  93.         {
  94.             colorInfo.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  95.             menu_mc.company_txt.transform.colorTransform=colorInfo;
  96.             colorInfoEx.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  97.             menu_mc.exhibit_txt.transform.colorTransform=colorInfo;
  98.             colorInfoCn.color = Color.interpolateColor(final_color[c],final_color[c+1],event.position);
  99.             menu_mc.contact_txt.transform.colorTransform=colorInfo;
  100.        
  101.    
  102.         }   
  103.        
  104.  }
  105. setInterval(changeColor,6000);

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 23 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.