views:

92

answers:

1

Hi,

What is the best way to debug a CRASHING flash app ? (no exception, my application just crash) I am actualy facing a big problem: my app (full-flash website) was working fine with the flashplayer 9 but crash with the flashplayer 10...

Here is the BAD method who crash my app with FP10. After removing the call to this method everything was working properly 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 finaly found the real PROBLEM... it was not the method in it self. I was passing NaN for the "A" argument causing an infinite loop...

+2  A: 

Have you tried running it with the debugger? Set a breakpoint at the entry of your app and then step 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 might be something that happens prior but at least you have narrowed down your search and can trace backwards.

Also another way is to put some trace() statements in your code and see if the section ever gets hit. Then you can tell if its happening before or after and repeat until you find the problem area.

Allan
thank you, i have set a breakpoint and i finaly found the method that crash flashplayer 10
OXMO456
@oxmo456 just out of curiosity - what was that method?
Amarghosh
@Amarghosh i've updated the question...
OXMO456