I have a simple countdown timer written in AS3 that builds up CPU use and frame render time progressively over time to the point of frame rate dropping to 2-3 per second over the course of 10 minutes. The timeline has 1 frame and the stage has 4 tlf text areas with instance names HH MM SS and FF. The code updates these text areas each frame based upon a comparison with the current time and an "event time".
I've looked in scout and the offending activity is a "Handling event 'render'" which eats up 95% of the active time
Code shown below
import flash.events.Event;
stop();
// ***Customization Point*** Enter the event date as (Year, Month - 1, day, 24Hr Hours, Minutes -1, Seconds - 1)
var End:Date = new Date(2013, 9, 15, 12, 0, 0);
var Now:Date;
var HH:Number;
var MM:Number;
var SS:Number;
var FF:Number;
stage.addEventListener(Event.ENTER_FRAME, tick);
function tick(e:Event = null):void
{
Now = new Date();
HH = (End.day > Now.day) ? (End.hours - Now.hours + (24 * (End.day - Now.day))) : (End.hours - Now.hours);
MM = (End.minutes == 0)? 60 - Now.minutes : End.minutes - Now.minutes;
MM = (MM == 60)? 0 : MM;
HH = (MM < 0)? HH - 1 : HH - 1;
MM = (MM < 0)? -1 * MM : MM;
SS = (End.seconds == 0)? 60 - Now.seconds : End.seconds - Now.seconds;
SS = (SS == 60)? 0 : SS;
MM = (SS < 0)? MM - 1 : MM;
SS = (SS < 0)? -1 * SS : SS;
FF = 30 - Math.round(Now.milliseconds / 33.33);
F.text = (FF < 10) ? "0" + FF.toString() : FF.toString();
S.text = (SS < 10) ? "0" + SS.toString() : SS.toString();
M.text = (MM < 10) ? "0" + MM.toString() : MM.toString();
H.text = (HH < 10) ? "0" + HH.toString() : HH.toString();
}
TLF TextFields are extremely expensive and have significant overhead over regular TextFields.
As a result where possible you should always use regular dynamic TextFields.