[Flashcoders] Debugger Text Field

2008-09-08 Thread eric e. dolecki
Hey all,
I have a class that serves as a debugger - containing a textfield that text
gets dumped into. Rather quickly. What might be the best way to simply limit
the number of lines in the field itself, as the appends after a while bog
the application down (understandable).

I have many ideas, but I don't want the mechanism to clean up add too much
overhead itself.

Thanks,
Eric
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Debugger Text Field

2008-09-08 Thread Christoffer Enedahl
I do something like this, It can be optimized, Im moving all logs every 
time when you can have something like a ringbuffer instead:


   private var _log:Array = new Array(20);
   public function log(t:*)
   {
   for (var i:int = 0; i  _log.length-1; i++) {
   _log[i] = _log[i + 1];
   }
   _log[_log.length - 1] = t;
  
   output.text = _log.join(\n);

   }

HTH/Christoffer

eric e. dolecki skrev:

Hey all,
I have a class that serves as a debugger - containing a textfield that text
gets dumped into. Rather quickly. What might be the best way to simply limit
the number of lines in the field itself, as the appends after a while bog
the application down (understandable).

I have many ideas, but I don't want the mechanism to clean up add too much
overhead itself.

Thanks,
Eric
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Debugger Text Field

2008-09-08 Thread Fabrício Seger Kolling - Dulldusk
   // update window after 1s without receiving data or case buffer 
exceds 100 chars

   function log(str) {
   buffer += str + chr(10);  
   if (buffer.length  100) {

   checkChange();
   } else {
   clearInterval(intervalCheckChange);
   intervalCheckChange = setInterval(this, checkChange, 1000);
   }
   }
   function checkChange() {
   clearInterval(intervalCheckChange);
   if (buffer.length  0) {
   TF_debug.text += buffer;
   buffer = ;
   if (TF_debug.text.length  (maxChars + 1000)) {
   TF_debug.text = 
TF_debug.text.substr(TF_debug.text.length - maxChars);
   TF_debug.text = 
TF_debug.text.substr(TF_debug.text.indexOf(chr(10)) + 1);

   }
   MC_scroll.gotoEnd();
   MC_scroll.checkChange();
   }
   }

Fabrício Seger Kolling - Dulldusk

Christoffer Enedahl wrote:
I do something like this, It can be optimized, Im moving all logs 
every time when you can have something like a ringbuffer instead:


   private var _log:Array = new Array(20);
   public function log(t:*)
   {
   for (var i:int = 0; i  _log.length-1; i++) {
   _log[i] = _log[i + 1];
   }
   _log[_log.length - 1] = t;
 output.text = _log.join(\n);
   }

HTH/Christoffer

eric e. dolecki skrev:

Hey all,
I have a class that serves as a debugger - containing a textfield 
that text
gets dumped into. Rather quickly. What might be the best way to 
simply limit
the number of lines in the field itself, as the appends after a while 
bog

the application down (understandable).

I have many ideas, but I don't want the mechanism to clean up add too 
much

overhead itself.

Thanks,
Eric
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders