Posted on Friday 9 September 2005
As I mentioned last post, I really enjoy the Flashout logger inline search function, regex capability and filtering options. On the other hand, I find it handy to be able to trace complex objects like the LuminicBox logger allows to. The LuminicBox logger has a TracePublisher to that works with the Flash IDE trace window, so we can use that functionality and Flashout at the same time for a very powerful tracing experience. Here's a simple wrapper class that does the job:
import LuminicBox.Log.TracePublisher;
/**
* @author Patrick Mineault
*/
class clib.TraceReplacer
{
private static var inst:TraceReplacer;
private var tp:TracePublisher;
private function TraceReplacer()
{
tp = new TracePublisher();
}
public static function replaceTrace(message:Object, classMethodString:String, file:String ,line:Number)
{
if(inst == null)
{
inst = new TraceReplacer();
}
//analyzeObj is private
var msg:String = inst.tp['analyzeObj'](message, 1);
Flashout.traceReplacer(msg, classMethodString, file, line);
}
public static function initialize()
{
//A dummy function to make sure the trace replacer is included in the file
}
}
To use, compile with -trace clib.TraceReplacer.replaceTrace. To make sure the file is compiled by MTASC, call TraceReplacer.initiliaze() before using TRACE.
Now if I write TRACE(_root) in the constructor of my TestSuite class, I get:
[40:01:762] debug: TestSuite.TestSuite()
(movieclip _level0) {
FLASHOUT_FILE_ID:"YzovcGF0L3Byb2pldHMvbGlvbmhlYWQvZGVwbG95L3Rlc3RzdWl0ZWJhc2Uuc3dm"
FLASHOUT_PORT:"4000"
FLASHOUT_ENABLE:"TRUE"
$version:"WIN 7,0,19,0"
btnTest:(movieclip _level0.btnTest) {
__q_click:(array:1) {
0:(function)
}
dispatchQueue:(function)
dispatchEvent:(function)
removeEventListener:(function)
addEventListener:(function)
__height:22
__width:100
focusEnabled:true
__html:false
__fontSize:12
__fontFace:"_sans"
__fontColor:0
__embedFont:false
__align:"center"
__toggle:false
__selected:false
__labelText:"Test"
__disableStyles:false
__focus:(movieclip _level0.btnTest.__focus) {
__rightMargin:5
__leftMargin:5
__bottomMargin:5
__topMargin:5
(and so on and so forth)
I can even see the click queue on the test button on the main stage. The filters in the Flashout logger allows easy navigation and search where this would be highly impractical in the normal, dog-slow Flash trace window. Simple yet so useful!


