Posted by: edsyrett | 22 January 2010

Logging debug messages to FireBug Console


FireBug is a very handy add-on for FireFox – you can find out more about it here.

In addition, FireBug provides a way of logging messages – see here.

Firebug adds a global variable named “console” to all web pages loaded in Firefox. This object contains many methods that allow you to write to the Firebug console to expose information that is flowing through your scripts.

So far, this is all for JavaScript debugging.  But don’t forget the ExternalInterface in Flex.  So we can call these methods just as easily from inside a Flex application as fron JavaScript.   Here’s one way to do it:

package utils { import flash.external.ExternalInterface; public class Console { public function Console() { } public static function log(message:String):void { ExternalInterface.call("console.log", message); } } }

And to log a message…

Console.log("Put your message here...");

Responses

  1. good to know, thanks, I was actually thinking that Flex was lacking of such logging tools but that’s actually not the case.


Leave a comment

Categories