Simple Flash to browser console logging

If you are like me, you like to be able to trace out commands etc from Flash into your browser container. I generally use FlashTracer on Firefox or a more full featured debugger.

However, sometimes I simply want to trace elements into the console of either Safari or Firefox. This is as simple as using ExternalInterface and a small javascript method that takes a single parameter and writes it to the browsers console, via console.log(). Which can then be inspected via Safari’s debug panel or within Firebug on Firefox. And yes, I realise I could use Flashbug or something similar, but to be honest, I hardly ever use Firefox, hence the desire for something that works in Safari.

Simple example file is attached.

Source files
Simple Flash logging (1258)

6 Neighs about “Simple Flash to browser console logging”



freemind Neighed:

nice! works with chrome too btw ;)
thx mate!

Özgür ALTAY Neighed:

@freemind,
How you can use this in Google Chrome?

Özgür ALTAY Neighed:

Ok I found it!
From the Javascript Console menu (CTRL+Shift+J)

bassta Neighed:

Hi Dale, check my solution : http://burnandbass.com/debug/ to this problem, the class also shows the fps/memory :)

Garry Neighed:

Theres an easy way from within flash.

import flash.external.ExternalInterface;
_root.debug = function( str ){
ExternalInterface.call(‘console.log’,str );
}

then just call _root.debug( your_message ); whenever you want.
No need for extra javascript on your page.

Dale Neighed:

Nice approach. Cheers.

Leave a neigh?