Too many traces locks flash

10 posts

Flag Post

So my work environment is 100% CS4. There’s an issue I run into when I compile and test where the whole flash program locks up as well as the rest of my computer. I’m positive it’s flash trying to output more trace commands per frame than it can handle. I don’t intentionally do it of course. It only happens occasionally and it’s always an easy fix EXCEPT for me having to restart my computer since I can’t focus anything except flash.

So, for example, if I somehow accidentally put a trace in a big loop inside of an enterframe event, I’m screwed and will have to hold down the power button on my system. If I click anything outside of flash, flash immediately reverts my focus back to itself. I cant alt F4 or use the task manager or anything. It’s really annoying.

Anyways, describing the problem isn’t really helpful or important since I know what it is. I’m wondering if anyone out there might have some suggestions for a solution. Is there perhaps a way to limit the amount of traces per frame or something just in case I (and I will) accidentally do this again?

 
Flag Post

Yes – use a custom function:

/* 
 * @subauthor bobwashere
 */
public static function myTrace(...args)
{
     if(++traceCount < 10)
        trace(args);
}

Then in enterFrame, reset the traceCount variable every frame.
Also, I’m not sure if it would be better to just use args:String or not.

 
Flag Post

Why not just have a trace log and append stuff to a private string variable and log the string once each frame instead of losing some data…

 
Flag Post
Originally posted by UnknownGuardian:

Why not just have a trace log and append stuff to a private string variable and log the string once each frame instead of losing some data…

That’s a good idea too:

/* 
 * @subauthor bobwashere
 */
public function enterFrame(e:Event)
{
    if(traceStr.length > 0) trace(traceStr);
    traceStr="";
}

/* 
 * @subauthor andhere
 */
public function myTrace(str:String):void
{
   traceStr += str + "\n";
}
 
Flag Post

I may be wrong, but you could run your game in the debugger. I think it will prevent your computer from crashing.

 
Flag Post

Haha, well I feel dumb then. Too busy wondering about some kind of options menu toggle or something to even think to try something that simple. Thanks for the suggestions.

I may be wrong, but you could run your game in the debugger. I think it will prevent your computer from crashing.

Traces still get outputted in debugger. My guess is it would still do bad things. Not sure though. I never really foresee it happening and don’t really use the debugger unless I’m getting errors. If flash didn’t take twice as long to test in debug mode, I’d run it every time. Since flash sucks so bad and crashes over stupid reasons or no reason at all, a lot of times I just compile it and open the swf file to test. I’ll prob move away from flash eventually, but I’m just more an artist than a programmer and really enjoy the vector animations and ease of implementation.

 
Flag Post

You can keep using CS to make animations, then import them with FlashDevelop and use that to code/compile/debug/anything_on_the_programming_side.

 
Flag Post

Output to string then save the string using FileReference at the end of the application.

 
Flag Post

I’m not sure if it works in the IDE, but you can try to edit your mm.cfg file to include TraceOutputBuffered=1. That should write them to disk all at once. Just set to 0 or remove the line when you want it off. I haven’t used it in awhile myself but I believe it still works.

You can also use FlashDevelop to read out your traces. It has options for the update interval and a pause feature. Tracing is still heavy handed, but it’s another option.

I use a variety of methods depending on the circumstances; including the modulo % operator if I just want to trace every X number of frames; as well as other methods mentioned above. Use what suits you.

PS: “So my work environment is 100% CS4”

Boo!

PPS: ItsaMeeeeeMario?! I just noticed!

 
Flag Post
Originally posted by Senekis93:

You can keep using CS to make animations, then import them with FlashDevelop and use that to code/compile/debug/anything_on_the_programming_side.

I can do that?

How? i must Know.