Paint called too late

Hello all,

This fla has a round mc “objet” on frame1 and a rectangular mc “objet” on frame2.

This is the as3 code:


for (var i=0; i<=this.totalFrames; i++)  
{ 
 this.addFrameScript(i, null); </SPAN>
 this.addFrameScript(i, Paint);   
}     
 
function Paint() </SPAN>
{ 
  var colorTransform :ColorTransform = new ColorTransform(); </SPAN>
  colorTransform.color=5000; </SPAN>
  objet.transform.colorTransform=colorTransform;   
} 

The problem is that in the swf final, if i go frame by frame, each mc is flickering and we can see very quickly the old color before the new color.

How to solve this?