Debugging a crashed Flash application

What is the best way to debug a CRASHING flash application? (no exception, my app just crashes) I'm really running into a big problem: my app (fully functional website) works fine with flashplayer 9, but crashes with flashplayer 10 ...

Here is a BAD method that crashed my application using FP10. After removing the call to this method, everything worked correctly with FP10.

public static function drawWedgeCrown(g : Graphics,a : Number,r : Number,r2 : Number, n : Number, c : Number, t : Number) : void {
            var x : Number ;
            var y : Number;               
            g.beginFill(c, t);
            g.moveTo(r, 0);
            g.lineTo(r, 0);
            var teta : Number = 0;
            var dteta : Number = 2 * Math.PI / n;
            while(teta < a) {
                x = r * Math.cos(teta);
                y = -r * Math.sin(teta);
                g.lineTo(x, y);
                teta += dteta;
            }
            x = r * Math.cos(a);
            y = -r * Math.sin(a);
            g.lineTo(x, y);           
            x = r2 * Math.cos(a);
            y = -r2 * Math.sin(a);
            g.lineTo(x, y);
            teta = a;
            dteta = 2 * Math.PI / n;
            var cpt : int = 0;           
            while(teta > 0) {
                cpt++;
                x = r2 * Math.cos(teta);
                y = -r2 * Math.sin(teta);
                g.lineTo(x, y);                           
                teta -= dteta;
            }
            x = r2 * Math.cos(0);
            y = -r2 * Math.sin(0);
            g.lineTo(x, y);
            g.lineTo(r, 0);           
            g.endFill();
        }

      

OK, I finally found the real PROBLEM ... this was not the method he used himself. I was passing NaN for argument "A" causing an infinite loop ...

+2


source to share


1 answer


Have you tried running it using the debugger? Set a breakpoint when entering the application and then walk through it until it crashes. This way you can see which line of code is responsible and the state of the variables. Of course, the actual problem could be something that happens before, but at least you've narrowed down your search and can trace back.



You can also add some trace () statements to your code and see if the section is damaged. Then you can determine if it will happen before or after and repeat until you find the problem area.

+2


source







All Articles