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...");
Advertisements

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: