1

I'm trying to create a crash report for my application. Getting the stack trace is easy when the game is running with debug: it is included in the Error object that is created in the crash. but when running with no debug, this information is missing.

Is there any way to get this information?

Nimrod Yizhar
  • 381
  • 4
  • 14
  • 1
    The documentation says: "For Flash Player 11.4 and earlier and AIR 3.4 and earlier, stack traces are **only** available when code is running in the debugger version of Flash Player or the AIR Debug Launcher (ADL). In non-debugger versions of those runtimes, calling this method returns null." Maybe try targeting a newer version of Flash Player or AIR and see if that works? – puggsoy Apr 09 '13 at 18:22
  • see http://stackoverflow.com/questions/13999626/can-i-build-a-debug-version-of-an-adobe-air-application/14000013#14000013 - question talks about AIR but applies to FlashPlayer too –  Apr 09 '13 at 19:47
  • Short answer: Not working. I have been trying this for a while and works only in debug mode. Also you could manually specify the class/line where this occurs but that is soooo ugly and unprofessional (also any code change requires updates) so I do not recommend it. – Adrian Pirvulescu Apr 10 '13 at 06:07

2 Answers2

0

You can use try-catch blocks in suspicious places of your app.

try {
    ExternalInterface.call('conf', 4);
    ExternalInterface.addCallback('transcodeReqAnswer', analyseTranscodeAnswer);
} catch(er:Error) {
    debugTextField.text = er.getStackTrace();
}
JustLogin
  • 1,822
  • 5
  • 28
  • 50
0

If you are compiling in debug mode you have to pass the parameters to javascript through ExternalInterface. Then you should be able to see the stacktrace from the console output of your browser.

Example:

flash.system.Security.allowDomain(sourceDomain)
ExternalInterface.call("print", error.getStackTrace());

and in JavaScript there should be a function

function takeLog(string) {
    console.log("stacktrace: " + string);
}

In non-debug mode the getStackTrace() function returns null.

More information in the official documentation, ExternalInterface.call(), getStackTrace()

konsnos
  • 34
  • 1
  • 4