Pages

Showing posts with label tips and tricks. Show all posts
Showing posts with label tips and tricks. Show all posts

2012/08/11

Late debug *.swf files in browser

Here is a little trick that I use in Flinjin for debug string output. Sometimes you need to make some late debug in browser. Some cases may be only available in browser. So here it is:

public class Logger
{
	public static function log(message:String):void
	{
		if (ExternalInterface.available)
			ExternalInterface.call("console.log", text);
		else
			trace(text);
	}
}

Now use Logger.log instead of default trace function and you can see all trace messages directly in browser console (i.e. Google Chrome's JavaScript console). It can be very useful!