简体   繁体   中英

How to debug SWF out of IDE?

I'm using FDT and Apache Flex 4.12 SDK in a project. I need to debug some exceptions triggered while the SWF interacts with JavaScript calls (using ExternalInterface), so I need to debug it while running at navigator.

I know I need to have the Debug version of Flash Player, and I already installed it. The debug version shows a menu option called "Debugger".

I already configured the mm.cfg file (file location and config options found here ) at correct location with the following options:

ErrorReportingEnable=1
TraceOutputFileEnable=1

The tested Flash Player versions are 11.2 (GNU/Linux) and 13.x (Windows 8). Testes web browsers are Google Chrome, Mozilla Firefox and Internet Explorer.

The "Debugger" option at player is disabled, but this link told us we need compile the SWF with debug symbols. So, I added the following options to the compiler:

-debug=true
-define=CONFIG::debugging,true

Using FDT, I can find the compiler arguments at Project properties -> FDT Compiler -> Compiler arguments.

Unfortunately, the debug option still disabled! What I'm missing? Old Flash Player versions show us a box with a the stack trace.

Additionally, I found the Firefox/Chrome extension FlashFirebug (link for Firefox version here ), but there's no free version anymore and I don't want to pay since all I need is to print the stack trace. Direct the output to the browser console using ExternalInterface does not works always as expected, so I really need the native Flash stack trace.

The debug option in FDT is controlled by which mode you launch your launch configuration. You can launch in debug or run mode. The following solution works only if you launch the launch configurations in debug mode.

Choose case A or B:

A: In case you have your own html wrapper in your bin folder you can do the following: Open your launch configuration you use for compiling in Debug configuration Dialog of FDT (I assume you use FDT to compile your application). Switch to the start tab and enter the launch uri of your html wrapper which starts the swf. Choose Browser as Viewer. Verify that Suppress exception popup is switched off. CLick Apply. Click Debug. Now the Browser should come up and the debug inside FDT should connnect to you application if the swf is correctly started from your html wrapper.

B: In case you have an external html wrapper somewhere do the following: Open your launch configuration you use for compiling in Debug configuration Dialog of FDT (I assume you use FDT to compile your application). Switch to start tab and switch off "open URI after compilation". Click Apply. Click Debug. Now the swf is create in debug mode and is placed inside the bin folder of your project. Copy the swf to the location from where the html wrapper could load the swf. Start your html application containing the swf. The debugger of FDT is still waiting for connection to that swf in background. If the timeout was already reach start the launch configuration again in debug mode and then start your application immedately. In case the debugger connects the console output shows that to you.

After case A or case B: provoke the exception in your application. The debugger in FDT should jump to the code line which causes the exception.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM