Copy link to clipboard
Copied
I have a flash app that works fine at first but if I leave it on for about 2 hours the frame-rate drops right down and cpu usage goes up. Memory usage stays steady indefinitely. By commenting out different functions I found the line of code that seemed to be causing the problem - it was just a timed event occuring every 1/8th of a second, updating the contents of a text box.
To make sure this was definitely the problem I made this simple script on the first frame of an empty project (it simply had a dynamic text box on the stage named "subtitles"):
var subTimer:Timer = new Timer(1,0);
subTimer.start();
subTimer.addEventListener(TimerEvent.TIMER, normalSubDate);
function normalSubDate(event:TimerEvent):void
{
subtitles.text="some text";
}
In an attempt to speed up the process the timer is set to maximum speed, frame rate to 60 (I do not know if this makes a difference). I downloaded a performance monitor addon to give me updates on memory and frame-rate usage. Memory stays relitively constant , however after about 5-10 minutes the frame rate begins to drop steadily until it grinds to a halt. There must be a problem with the way I am using either the timer or the text box.
Thanks
Copy link to clipboard
Copied
there's no problem with that code (unless you're repeatedly executing it).
Copy link to clipboard
Copied
I am running the code exactly as it appears here, and it is slowing the computer down after about 5-10 minutes. However, I have just realised that I am using the "TLF" type of text box - for some formatting reasons that I do not really remember right now. When I changed it to the standard "dynamic" text box there is no drop in framerate. Perhaps I need to use one of the TLF methods to update the text rather than just re-define it constantly.
Copy link to clipboard
Copied
you should avoid using tlf textfields.
Copy link to clipboard
Copied
It looks that way yes, it seems a shame - I tried using "replaceText" with the TLF field - made no difference. Going to switch to classic and deal with the other issues some other way. Thanks
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now