Sometimes you need to check what's happening under the hood while your Flash file is live online. One method to do this is to simply create a dynamic text field and then write debug text to that as required.
Another method which is a bit cleaner imo is to use the Flash Remoting NetDebugger. There's a handy panel that comes with this called the NetConnection Debugger. If you're using Flash Remoting already then you can use this panel to see what data is getting sent in and out of Flash. Another function of it is to accept remote trace calls. That last bit is what we're after here. It's very easy to implement, as in 4 lines of code to implement.
Download and install the Flash Remoting files if you haven't go them already. You can get them here
. If you have Flash CS3 then checkout some of the results from this
google search to see your options.
Stick this at the top of your main Flash file:
That imports the relevant classes and then initialises the debugger.
On the main menu in the Flash IDE head over to Window->Other Panels->NetConnection Debugger. That should open the debugger window.
Use the debugger. To trace from an online Flash file you just have to stick this code in the section you want to trace from:
NetDebug.trace("I'm being traced!");
Note that if you're tracing from inside a class or another file that is not the one you put the code from Step 2 into then you'll need to add the same import statement (from Step 2) to the top of this second file, not the initialise line though.
Try it out. Upload your Flash file, make sure you have the debugger open (Step 3) and then view the file with your browser. You should see the trace statement appear in the debugger.
The debugger is pretty cool when you're using Remoting as it can show the contents of arrays your passing amongst other things. I use it with AMFPHP to see what's going on in various places.
The Flash help docs list these as two steps to do before the ones I listed. When I tested it I didn't have to do this and it still traced for me:
- From the Window menu in Flash, select Other Panels > Common Libraries > Remoting.
- From the Library panel, drag the RemotingDebugClasses library to the Stage.
Another handy thing the docs point out is that you can run the debugger outside the IDE by launching it's swf file directly:
Originally Posted by LiveDocs
C:\Program Files\Macromedia\Flash MX 2004\en\First Run\WindowSWF\
HD:Applications:Macromedia Flash MX 2004:First Run:WindowSWF: