Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CPU load increases over time with text box update, what is wrong here?

New Here ,
May 11, 2013 May 11, 2013

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

TOPICS
ActionScript
669
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2013 May 11, 2013

there's no problem with that code (unless you're repeatedly executing it).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2013 May 11, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2013 May 11, 2013

you should avoid using tlf textfields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2013 May 11, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 12, 2013 May 12, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines